I have a custom object - Object 1 and the Opportunity object. I've created a lookup field from the Opportunity to Object 1 and I am working on a trigger to populate the id of one related record into the lookup field, in order to reference some of the values, back on the Opportunity.

The related records on the Object 1 are being created first (as part of an integration) and one Opportunity, could have 1+ related records, but only one related record will be populated in the lookup field.

Once the lookup field is populated through the trigger, I want to be able to change the picklist value on the Opportunity based on a text field on Object 1.

I have tried to change the picklist value using PB or Workflow, but it didn't work.

The scenario is to change picklist value to:

  • "A" - if the text field contains "a", but it might also contain "b", "c" or "d", but it should definitely contain "a".

For each picklist is a combination of the above.

For one picklist value though:

  • "E" - if the text field contain 2 or more of the "a", "b", "c" "d" combination.

Considering the Opportunity can have more than one related record, I am not sure if it's possibe to do this through a formula - to check all the related records.

Workflow I have tried for one scenarion:

OR (
CONTAINS(Object_1__r.text_field__c, "a" && ("b" || "c" || "d"))

and field update: picklist value = A

but the fuction ISCHANED cannot be refrenced for my field.

Any help or ideas will be much appreciated.

Thanks a lot.

  • I think you just have missed coma in OR ( ISNEW() ISCHANGED(Object_1__r.text_field__c)) between ISNEW() and ISCHANGED(Object_1__r.text_field__c) – Mariia Illarionova Nov 22 '19 at 14:39
  • @MariiaIllarionova - Hi, Sorry. I do have it in my formula. I just missed to type it here. – SSimion Nov 22 '19 at 14:57

If the lookup field is located on the Opportunity, then your Opportunity has exactly one or exactly zero related records. A lookup field cannot point to more than one record, and it doesn't matter how many other records might be considered "related" based on the business semantics of your data unless you build automation to consider those records.

Workflow Rules and other automation cannot react to changes across relationship fields, like this:


You can react to changes in the lookup field itself (Object_1__c), but not to changes on the related object. To do so, you need to build automation, in this case a Process or a Trigger, on the related object, which would update the Opportunities accordingly.

  • Thanks a lot for your reply. Since for 1 Opportunity, there can be more than one related record, I have created a lookup on the custom Object to the Opportunity, that I am populating through a Trigger and I have created a Process on the custom Object to populate on the Opportunity different fields and change the pick-list of the Opportunity. The trouble I am having is that the Process executes the first immediate action, if more related records are triggered, then removes the first value and fires the second immediate action. – SSimion Jan 13 '20 at 16:41
  • 1
    I think this is more than can reasonably be addressed in a comment. If there are multiple related records, I think your data model may be incorrect. – David Reed Jan 13 '20 at 16:56
  • Agreed, David. I have just posted a new question, as the context has changed, and I can't seem to find a solution, so any direction will be more than welcomed. – SSimion Jan 20 '20 at 16:55
  • Hi David. I have re-posted my question - salesforce.stackexchange.com/questions/291774/… and it will be amazing if I can pick your brains :). Thanks a lot – SSimion Jan 28 '20 at 16:40

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.