Can i ensure all Contacts under an Account automatically get assigned to the Account's Assigned To/User?

Hi Team,

When you create Contacts from an Account (record) by using the + button, the contacts are automatically assigned to whoever is adding it. I would like to know if you guys know of any way that we can ensure they are Assigned to the Assigned user of the Account?

Thanks,

  • It is pretty possible and requires creating an extended vardefs for Accounts.

    Take a look at modules/Accounts/vardefs.php and look for "populate_list".

    You will see leads link field has such attribute which tells SugarCRM to copy fields name and phone_office in Accounts into fields account_name and phone_work in the created Lead.

    So you just need to create the file custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_contacts.php with a content like that:

    $dictionary['Account']['fields']['cases']['populate_list'] = array(
     'assigned_user_id' => 'assigned_user_id',
     'assigned_user_name' => 'assigned_user_name',
    );

    Go to Admin -> Repair -> Quick Repair and Rebuild

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Peter,

    You will need to override the create.js controller for the contact and get the assigned to user ID from the parent model and assign it to the assigned to user field of the new contact you are creating. You will need to add a condition thought to check that the parent is "Accounts" module.

    Regards

  • Hi Peter,

    If it is enough for you to be able to filter on the name of the assignee in the contacts-module, you could also do it just with Studio and Sugar Logic.

    We are not using the assigned to-field in accounts and contacts, as it is not enough for us. We have multiple departments and SalesReps dealing with the same account and partially also the same contacts. So we have our own user-relationships in accounts, and wanted to copy the respective names in the related contacts automatically, too. For our use-case it was enough to be able to filter by the name of the person, so we are working with text-fields into which the name of the respective assignee is pushed.

    So, I created text-fields in Studio in the accounts-module, that copy the name out of each user-relation.

    The sugar Logic formula looks like this ($users_accounts_1 is our custom relation - but you could just replace it with $assigned_user_link for your purpose).

    concat(related($users_accounts_1,"first_name")," ",related($users_accounts_1,"last_name"))

    In the Contacts-module I again created text-fields that copy the information from these account-text-fields with a simple related formula.

    That way we get the name of the SalesRep added to the contact records automatically (when saving the contact) without any code modifications.

    Kind regards,

    Julia

  • I've addressed this with a simple process using a business rule.  Basically, the process looks at the Contact Record when it's saved (new records and all modifications to avoid creative reassignments :-) ).  The business rule assigns the Contact to the proper sales rep based on the assignment for the Account.

    I suppose you could also just code it with a "change field", but I use the same business rule in multiple processes and when there's a change I only have to change it in one place.

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)

  • Hi Bud,

    Thanks for the response - I have been trying to figure out how to do this and read online documentation but am struggling to understand how we get this to going!

    When designing the Business Rule, is column 1 the Accounts 'Assigned To' field and then column 2 the Contacts 'Assigned to field' ?

    I have tried working it out multiple times but am scratching my head now hahah

    Thank you

  • Hi Peter Pavisic,

    If I understand Bud's description correctly, the columns in his Business Rule looks something like this example:

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  

    Where the Conditions column is:

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  

    And the second Conclusion column is:

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  

    I hope this helps!

  • Hi Peter,

    I have a field in the Account Record that identifies the Sales Territory - the condition in my business rule is "If the Sales Territory Code = 123", it returns the Assigned User...

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)

  • Hi Bud Hartley @patrick,

    Thanks for your replies! I have tried following the above but still not getting the Contacts to save to the Account Assigned User.

    This is what I have setup:

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  

    So in my case I am testing to see if a Contact created under David's Account saves under David's name as well.

    It looks like I have set this up properly but cant see any results? What do you guys think?

    Thank you,

  • Hi Peter Pavisic,

    Can you export the process definition using this business rule and attach the .bpm file to a reply here?

    Edit: I have attached my example that is working as expected in a stock 9.0.0 Enterprise instance.

  • Hi Patrick,

    Not sure if i have exported this correctly.

    It exported straight to a pbr file? I have attached it for you to see

    I'm also on an Enterprise 9.0.0 version.

    Thanks for your help - I am new to being an admin/designer of Sugar and there is lots to learn!

    Regards,