Import custom module with relationship to accounts

Hello.

I created a custom module - "Customer Licenses" and established a relationship to Accounts.

Sugar correctly created the module and added the subpanel to Accounts. I can add "customer license" records. Everything looks and works well. The table is in the DB as is the relationship table (accounts_customer_licenses).

Now I want to import customer_license records from our legacy system into Sugar.  I go to "Import" and download the import template.  The correct customer_license columns/fields are there.

But there is no way to relate these to accounts. When I read the Import guide and the Importing Related Records guide, they both state we should fill in the appropriate account ID field (after getting the account ID).  We've done this with several other types of modules (contacts, cases, etc.).  But there is no Account ID field in the customer_license import template - so nothing to fill in and no way to relate these imported records to their associated account.

I suppose we could write routines to load the customer_licenses and then manually load records in the join table (accounts_customer_licenses) but we certainly don't want to go through all that trouble.

Are we missing something here?  As far as I can tell, we're trying to do the same thing with this import that we would be doing if we were trying to import Contacts and relate them to Accounts.  In that case, there is also a relationship table and it gets populated because there is an Account_ID column in the Contacts import template.

Thanks very much for your help.

Bob

Parents Reply
  • Hi Francesca.  Thanks for your reply.  I just checked and both Contacts and Cases have no relate field with Accounts. They do both have relationships with Accounts and the Account ID does show up in their import template.

    As I mentioned, there IS a relationship table between accounts and my custom module - based on the relationship I built between the two.  I guess we'll have to import both modules separately and then populate the relationship table. Very frustrating but it can be done.

    Thank you.

Children

  • That is curious, perhaps there is something special about those import processes that was built just for those modules.

    I've never worked in the Sugar Cloud environment, always on-site so things are a little different for me.

    You could try to see if you can understand what it is that is different in the Import process for those standard modules (reverse engineer it in a local copy of your SgarCRM) and customize your custom module's Import to mirror those or see if you can leverage the Sugar APIs to do your import and link the beans programmatically.

    Best of luck!

    Francesca

  • Hi Bob,

    When you add a relationship using Studio, Sugar ALWAYS create the table regardless whether it is a one-to-many or many-to-many. To add the Account ID as a field in your custom module, you will need to export the package from Module Builder, unpack it, hand-craft the relationship, and zip it back up for installation. 

    You can use a custom package to install that relationship afterwards too - it is just a matter of crafting it correctly.

    Good luck,

    Romney