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
  • I just created a new module "licenses" in modulebuilder, type basic with a many-to-one relationship to accounts.

    After installation I changed the labels of the related Accounts feld to "licenseowner" just to be able to identify it better.

    Then I created an import file, started the import and assigned the company name from the import file to the field with the label from the relationship "Licenseowner".

    After the import, all accounts were assigned to the licenses.

    So this mechanism should work in the current version. Perhaps you must check your labels.

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

  • Wow. I had never thought about using the "name" field... I never saw it because I was always looking for the ID field! 

    While this is not entirely safe (you may have contacts with similar names for instance), it's great news still!

    Damien Pochon

    CRM & Digital consultant @ ITS4U Group

  • When you add a label for the ID to custom/Extension/modules<yourmodule>/Ext/Language/en_us.anyname.php you can select the ID during the import.

    I added one line to the above file and got the possibility to select the ID.

    <?php
    // WARNING: The contents of this file are auto-generated.
    $mod_strings['LBL_LIC_LICENSE_ACCOUNTS_FROM_ACCOUNTS_TITLE'] = 'Licenseowner1';
    $mod_strings['LBL_LIC_LICENSE_ACCOUNTS_FROM_LIC_LICENSE_TITLE'] = 'Licenseowner2';
    $mod_strings['LBL_LIC_LICENSE_ACCOUNTS_FROM_LIC_LICENSE_TITLE_ID'] = 'LicenseownerID';

    The name depends from your module names and the created relationship name. You can find its value in cache/modules/<yourmodule>/<yourmodule>vardefs.php

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Reply
  • When you add a label for the ID to custom/Extension/modules<yourmodule>/Ext/Language/en_us.anyname.php you can select the ID during the import.

    I added one line to the above file and got the possibility to select the ID.

    <?php
    // WARNING: The contents of this file are auto-generated.
    $mod_strings['LBL_LIC_LICENSE_ACCOUNTS_FROM_ACCOUNTS_TITLE'] = 'Licenseowner1';
    $mod_strings['LBL_LIC_LICENSE_ACCOUNTS_FROM_LIC_LICENSE_TITLE'] = 'Licenseowner2';
    $mod_strings['LBL_LIC_LICENSE_ACCOUNTS_FROM_LIC_LICENSE_TITLE_ID'] = 'LicenseownerID';

    The name depends from your module names and the created relationship name. You can find its value in cache/modules/<yourmodule>/<yourmodule>vardefs.php

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Children