function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
timmadigantimmadigan 

Using Contact fields in an Account formula

I've been ordered to simplify the life of my Account Managers and need to find a way to reduce the number of times they check for the same thing.
 
Currently we have a check box on the Account detail that shows whether the Account is Referenceable and another one on the Contacts detail to show who is Referenceable.
I'm trying to do a formula (or group of formulas) so that if they have a Contact marked as Referenceable and is still an active client (another picklist in the Contact detail), the Account will reflect this and can be reported as such (and easily seen in the Account detail section)
 
Normally, I'd do a roll-up summary but the system doesn't recognize Contacts as a child of the Account (for some really strange, unexplainable reason) nor is the Contact available in the list of formula fields.
 
If anyone has an idea pull this off, i'd greatly appreciate it.
NikiVNikiV
Since the Contact-Account relationship is not Master Detail, you can't create a rollup summary.  Too bad that's not (yet) available for lookup fields ... vote for this idea if you think it's a good one.

In the meantime ...

You could consider writing a trigger on the Contact object that will ensure its related Account's "referenceable" checkbox is checked when the Contact's reference field is checked.  When you are unchecking the Contact's reference field, the trigger would need to check all the other Contacts related to this Contact's Account to see if any of them are still checked before updating the Account's field if necessary.

I did something similar to this for a client that wanted to know if there were any "Activated" support Contracts linked to an Account - I created the trigger on the Contract to update the Account status field to Active, Pending or None depending on the Contract's status.  Then I created a fun stoplight formula field on the Case page to reflect whether the Account had an active contract.

If you need help with this, let me know.



Message Edited by NikiV on 11-27-2008 08:33 AM
AccidentalAdminAccidentalAdmin
I didn't think this was possible!

I've been wanting to do this for a long time, updating an Account field based on how some Opportunity fields are set. I want to make sure the Account Type matches a certain value if there are any open Opportunities on the Account, and matches a different value if there are any Closed-won Opportunities.

The workflow field update tool doesn't enable this.

Here's what the help text says:

"For most standard objects, workflow rules can only perform field updates on the object related to the rule. However, for Case Comment and Email Message records, you can create a field update action that updates a field on the related Case record. For example, you can create a rule to change the status of a case from "Awaiting Customer Response" to "In Progress" when a customer adds a case comment."

Am I reading it wrong?
NikiVNikiV
You are right that the workflow module doesn't (yet) allow updates on related records.  As well, we can't create rollup summary formula fields on Lookup relationships, which would give us a solution in combination with workflow on the Account when the "Number of Won Opps" > 0 for example.  I was suggesting an Apex trigger that would handle this in the meantime.

In your case, you could code a trigger on the Opportunity that after it is inserted, updated or deleted, check all Opps linked to its Account and determine if there are any Closed Won - if so update the Account Type.  If there aren't, then look for any open Opps - if so update the Account Type, etc.  You can do all sorts of logic this way that the workflow can't handle without the roll up summary fields.

Niki
SkypeFlyerSkypeFlyer

Hi NikiV,

 

 I have come to various dead ends on a task I am trying to work out.  And reading this I think yo ucould help me?

 

Basically I need to roll up some fields in Contacts to make a general field in an Account that reflects this result.

 

I have never written any Apex code or triggers and want to try doing this myself rather than getting professional services.

 

Could you guide me in the right direction?

 

Many thanks

Harriett

(harriett.lowinger@skype.net)