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
dgscarikadgscarika 

Firing a trigger when object is linked to another

Hi,

 

It's not clear to me in reviewing the APEX spec whether the following is possible. I thought I'd check the feasibility here before attempting to implement. I have a lookup relationship between leads & a custom object. I was hoping to fire a workflow rule when the lead is linked to this object. However, that does not seem possible. Therefore, I'm hoping that the following can be done via a trigger.

 

  • When a lead is linked to a custom object through this field, I would like to:
    • Retrieve the linked custom object record.
    • Retrieve a field from the custom object record.
    • Set a field in the lead record based on the field value from the custom object record. 

 

Can anyone confirm if this is possible - or confirming that it is not possible would be useful to know as well?

 

Any advice would be appreciated.

 

Thanks for your help

 

Dave

trekbintrekbin

Hi Dave,

 

This is possible using a Custom Formula field on the Lead. While setting it up, you can choose Advanced Formula which will allow you to link it with any of the Custom object's fields.

 

Let me know how it goes.

 

-Santosh Prasad

 


 

 


 +1 (646) 682-6536

jkucerajkucera
The catch w/ a formula field is that it won't trigger the Lead workflow where a cross object field update from a trigger will.  I'd probably stick with the trigger to ensure the lead workflow rules evaluate.