3

I'm trying to update a "Status" field on the Contact in two ways.

  1. The Contact has a child object, Prospect, and when changed, the Status field on Contact (let's say it's changed to Active) should update all Prospect children to Active.

  2. If the status on any one Prospect is changed, the Contact should update with that status and then run the first scenario, where all children are updated (e.g. I change 1/5 Prospects to Active and the Contact and all 5 Prospects become Active.

I'm using a Cross Object trigger to do the first scenario, but really can't figure out the second.

Thanks!

3

So you have a working trigger on Contact for the first?

On the second, a trigger on Prospect__c you would just need to query for Prospects where Contact__c == the Contact__c of the firing record. If you edit your question to show what you've tried, people can give more specific help.

Alternatively, you could do a cross-object workflow field update from Prospect to Contact, which would fire your Contact trigger and update the children. It would re-edit the Prospect__c record you edited to kick the process off (unless your SOQL filters not just on parent, but on the Status != Parent as well), so keep that in mind.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.