You need to sign in to do that
Don't have an account?
Christi
Account Score formula based on Contact Score sum
We are switching to an Account Based Marketing model and looking to create an "Account Score" formula field that basically takes the sums up the individual "Contact Scores" of all contacts associated with an account. I know of a few services like engagio that can do this but if there is a more organic (and free) way to do this I want to know.
Can anyone help? Truly appreciate any help I can get.
Can anyone help? Truly appreciate any help I can get.
Hi Christi,
For this, you need to make a trigger to roll up the sum of Contact Scores on its corresponding Account.
Account - Contact relationship is 1:N, so you cannot access Contact data from formula.
Also, since it is a Lookup relationship, you cannot have direct rollup summary fields either.
You need a trigger on Contact object to populate this score in Account.
Try this trigger below.
I have assumed that the API names for the score fields are Contact_Score__c (Contact) and Account_Score__c (Account) and they are Decimal type.
Adjust the names as it fits your design.
Let me know if this helps.
Happy to help. And, I am also learning new aspects on the way.
Yes. You need to do the update once then let the trigger take care of the future updates.
You can use the following code (extracted from the same trigger above) to update the data once. You can run this code in "Developer Console" - "Anonymous Window".
You need to consider your data volume here.
For example, line 2 of the above code will try to fetch all the Contacts in your ORG and update the Account Score for them. If you have 10K or 20K records, this will work without any issues.
If you have a lot more than that, you need to figure out a way to do it batches. You may like to try something like this. The above query will return all the Contacts whose Account Name starts with 'A', and so on.
Idea is to bring down the Query output size so that you will not face any issues in UPDATING the accounts.
Hope this helps.
Let me know if you have more queries.
I used the default test options to run my validation test which resulted in failure due to
"Code Coverage Failure - Your code coverage is 64%. You need at least 75% coverage to complete this deployment."
Can you help me understand where the problem lies? This would help me immensely. Thanks a lot.
You need to have one to improve the code coverage.
If you do not have one already, try this. Let me know how it goes.
I am trying to achieve the same as above - return the sum total contact's score at the account level. I implemented this code in my sandbox but the account score is only reflecting the most current contact score instead of the sum of total contact scores. Any advice?