Relate field does not update during import in SugarCRM

I have build custom Module in SugarCRM and added a custom field of type 'relate' and linked with Accounts module. When I insert new record for this custom module via normal add/edit view it works perfectly alright and I can select an account via Account Name field. However when I use Import feature via CSV file it does not link with Accounts module however the Account already exists with same name. Same Account Name is working for other modules during import.

I am working on SugarCRM 6.5, I have build Custom Module via Module Builder than added custom field via Studio and also I have Many to Many relationship with this custom Contacts Module and Accounts Module.

Also as per the documentation when we create a relationship it automatically generates a field for relevant modules, but I do not see this happening in case of many-to-many relationship that's why I had to create a relate field that correspond to Accounts module.

Any help in this regard will be appreciated, I have already spent lot of time already to figure this out.

  • Aamir,

    I am not sure if you are using the Community Edition, so I tested this in CE 6.5.22. The steps I took to reproduce this scenario are:

    1. I created a test contact type module, deployed it
    2. In Studio > Contacts > Fields > Created a custom relate field that points to the Accounts module
    3. Added the relate field to the Contacts Edit and Detail view layouts
    4. Manually created a record in the Test custom module and related an account to it
    5. From the Test custom module listview, I exported it in order to see how therelate field was formatted
    6. Within the CSV file I removed all the columns except the required fields and the account relate field and renamed the last name field to a different value
    7. Imported the file into the Test custom module

    The related account in the relate field displayed after the import. 

    Can you verify if the account ID is mapped to the correct relate field during the import process?

    Lori

  • Hello Lori,

    Thanks for taking time for looking into this issue.

    Yes, I am mapping to the right field. The field name is Account Name and this is the only field with this name. Even if I export these Contacts and then import the same csv file back in it does not consider the Account Name after import. Account Name field remains empty.

    Also I have a query regarding many-to-many relationship. Should't there be a field already as I have setup many-to-many relationship as well between this VIP Contacts module and Accounts module?

    Kind Regards

    Aamir

  • A bit of distinction here that might help.

    When creating a custom field of type relate, this adds a single related field, in your example Accounts.  To show up this field must also be added to the detailview and editview.  (sounds like this has been done).  Note that this field of type 'relate' is a single field and can be viewed as a one way street, in that only the related Account will show up in the VIP Contacts module.

    There is a distinction when referring to 'realtionships' rather than a single relate type field.  Relationships can be viewed as a two way street, and relate both modules to one another.  So, if you have a 1-to-1 relationship between Accounts and Contacts, the result will be a single contact relate field added to Accounts and a single accounts relate field added to Contacts.

    Similarly, if you define a Many-to-Many relationship then the result will be each module will contain a sub-panel for the other module.  Since each module can have MANY related records they will be displayed in a sub-panel rather than a single relate field since this is a two way relationship compared to a single relate type field.

    With all that said, you may double check for the single relate field and/or the many-to-many relationship sub-panel in your custom module.  The unexpected results might be from confusing or intermixing these two types of related fields during your import.

    I hope that helps...

  • Thank you everyone who participated in this post and help me. I just removed the relate field, changed many-to-many relationship to one-to-one relationship and used relationship field instead of relate field in the add/edit view and everything worked perfectly alright.

    Thanks again.

    Kind Regards,

    Aamir