I have a custom object - Object 1 and the Opportunity object. There was no relationship between the two objects, so I've created a lookup field from Object 1 to the Opportunity , that I am populating through a trigger, in order to update some fields from the custom object on the Opportunity, but also to change a picklist value on the Opportunity.
The records on the Object 1 are the Opportunity Line Items triggered from another system in Salesforce, so every time a modification happens (e.g price) in the other system, a new record is being created in Salesforce for the same OLI, but with the new value (price). The records share the same "lineitemid" to identity that records relate to the same opportunity line item.
What I am trying to achieve:
to populate custom field 1 from Opportunity with custom field 1a from Object 1.
to populate custom field 2 from Opportunity with custom field 2a from Object 1.
to change picklist value on Opportunity based on below:
"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.
What I have done so far:
- Create the lookup field between the objects and populate it through trigger
- Created a process on Object 1 - when a record is created or edited, with immediate actions:
custom_field1__c FIELD REFERENCE customfield1a__c
The process builder is populating the custom field1 on Opportunity with the custom field 1a from Object 1 value, but if I get a new record in Salesforce where custom field 2a is populated on Object 1, it's deleting the value in the custom field1 on Opportunity and it's populating the custom field2 on Opportunity.
Essentially, I want the process to keep the value in custom field 1 on Opportunity and also add the value of custom field2, when it gets populated on Object 1.
I don't seem to be able to find a solution. Any help with be much appreciated.