concatenate multiple contact emails into a single account field

Hello!

We added a custom checkbox field ("Billing Contact") to our CONTACTS module. If there are 10 CONTACTS belonging to a single ACCOUNT, any of the CONTACTS could have the "Billing Contact" checked.  That means when we send a billing notice to that ACCOUNT each of the billing contacts should get a copy of the invoice.

Sugar is integrated with our billing system (QB), which sends out the billing invoices. 

We'd like to create a non-display field on the ACCOUNT called "Billing emails" and then concatenate all of the CONTACTS email addresses together for CONTACTS who are checked as "Billing Contacts."  So our non-display field would contain:  "email1@email.com;email2@email.com...".  We would then map this non-display field to our QB interface and QB would send the invoice to everyone.

I recently learned how to use the rollup functions (thanks to people in this forum) which loops through all related records to do math things.  I was hoping there was similar functionality that would let me loop through all of the CONTACTS that are "Billing Contacts" and concatenate their email addresses together to suit our purposes.  But nothing jumps out to me in any of the forums, documentation, or Google searches.

If anyone can suggest an approach to this that I'm not seeing, I would really appreciate it.

Thank you!

Bob

Parents
  • This is an old question, but I came across it while answering a similar enquiry so I thought I would update here for anyone else coming across it.

    I would go a totally different route and not try to concatenate emails into a field... you'll get yourself in trouble and potentially not have current information when a Contact gets updated and the Account does not.

    But I'm a developer, and you'll need one on hand for this:

    I don't know what your integration looks like but I assume QB is leveraging your Account ID to get the information needed for the the billing invoices (else how would you even get the non-display field you mentioned)

    It should be easy enough (with a programmer's help) to extend that integration to get related Contact records with the "billing_contact_c" flag set by leveraging the Sugar's APIs and filter construct.

    see a basic example for contacts related to an account here:

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Cookbook/Web_Services/REST_API/PHP/How_to_Fetch_Related_Records/index.html

    The API call, with the added filter, would look something like:

    '/Accounts/60f2b566-30b5-11ea-8ef6-001a4a160206/link/contacts?filter[0][billing_contact_c][$equals]=1';

    where 60f2b566-30b5-11ea-8ef6-001a4a160206 is the Account ID for the Account in question.

    The results would look something like what you see in the link above (a bit ugly, I know) but the only Contacts related to the Account that are returned would be the ones marked "Billing Contact" at the time that the API is called, and extracting the primary email address for each one from there would not be hard.

    This way you always get current and up-to-date information and don't have to worry about formulas triggering or not triggering etc.

    Even better, would be a custom API that given an Account ID returns the concatenated email addresses of the related contacts that have the flag set.
    That would be a pretty simple piece of code, for a PHP developer with some Sugar knowledge, that leverages the Sugar Beans.

    Again, you would get the most current information and don't have to worry about formulas triggering or not triggering etc..

    In either case you will need someone to work on your QB integration code and possibly Sugar code to get the best results.

    Hope this helps give you some ideas,

    FrancescaS

Reply
  • This is an old question, but I came across it while answering a similar enquiry so I thought I would update here for anyone else coming across it.

    I would go a totally different route and not try to concatenate emails into a field... you'll get yourself in trouble and potentially not have current information when a Contact gets updated and the Account does not.

    But I'm a developer, and you'll need one on hand for this:

    I don't know what your integration looks like but I assume QB is leveraging your Account ID to get the information needed for the the billing invoices (else how would you even get the non-display field you mentioned)

    It should be easy enough (with a programmer's help) to extend that integration to get related Contact records with the "billing_contact_c" flag set by leveraging the Sugar's APIs and filter construct.

    see a basic example for contacts related to an account here:

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Cookbook/Web_Services/REST_API/PHP/How_to_Fetch_Related_Records/index.html

    The API call, with the added filter, would look something like:

    '/Accounts/60f2b566-30b5-11ea-8ef6-001a4a160206/link/contacts?filter[0][billing_contact_c][$equals]=1';

    where 60f2b566-30b5-11ea-8ef6-001a4a160206 is the Account ID for the Account in question.

    The results would look something like what you see in the link above (a bit ugly, I know) but the only Contacts related to the Account that are returned would be the ones marked "Billing Contact" at the time that the API is called, and extracting the primary email address for each one from there would not be hard.

    This way you always get current and up-to-date information and don't have to worry about formulas triggering or not triggering etc.

    Even better, would be a custom API that given an Account ID returns the concatenated email addresses of the related contacts that have the flag set.
    That would be a pretty simple piece of code, for a PHP developer with some Sugar knowledge, that leverages the Sugar Beans.

    Again, you would get the most current information and don't have to worry about formulas triggering or not triggering etc..

    In either case you will need someone to work on your QB integration code and possibly Sugar code to get the best results.

    Hope this helps give you some ideas,

    FrancescaS

Children
No Data