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
steve456steve456 

Tricky Issue

I have two objects

 

Object 1

 

Object 2

 

 

Object 1 has a field "Field1"

Object 2 has a field "Field2"

 

Object 1 has  a field "CommonField" which is a lookup from Object2

 

 

Field2 is a formula  referring to a "Field3" in "Object 3"

Field1 is a picklist

 

 

When "CommonField" of Object1 is changed 

 

Field1 should have a value corresponding to the Field2 value

 

 

Any approach how to write the trigger for it

 

 

Best Answer chosen by Admin (Salesforce Developers) 
MattLacey.ax1065MattLacey.ax1065

Why not make Field1 a cross-object formula field itself? It can traverse CommonField to get the value it needs from Object 2.

 

All Answers

MattLacey.ax1065MattLacey.ax1065

Why not make Field1 a cross-object formula field itself? It can traverse CommonField to get the value it needs from Object 2.

 

This was selected as the best answer
steve456steve456

u mean to say that put field 1 itself in object 2 and then map righht

MattLacey.ax1065MattLacey.ax1065

Replace the picklist with a formula which does the mapping, so:

 

CASE(Object2.Field2, 'value1', 'result1', 'value2, 'result2', 'result3')

 

Then as soon as the lookup changes you'll see tne new value as soon as you view the record.

steve456steve456

cross object reference is a betteer solution matt