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
SabrentSabrent 

Trigger instead of Workflow

I have a field called Activity_Type__c which I want to be populated based on the value of Status__c in other custom object.

Eg: IF Status__c = 'Submitted' , Activity__c = 'Submitted'. Like wise based on the Status__c value, there are 6 different Activity__c values.

 

I can do this through work flow, but that would mean creating 6 workflows for Field Update when each condition is satisfied.  I want to do this through Trigger but need help. 

 

Can somone please help me get started? Thanks in advance.

Starz26Starz26

If you can do it through workflow I would stick with that. Generally workflow is eaiser to manage and can be modified using point and click. Placing the same functions in a trigger requires and increased level of experience to manage and modify....

 

You should be able to do this with two workflows one for the Status__c and then one to update other fields based on Status__c

shruthishruthi

If your custom object [ActivityObject__c] is a lookup on the object StatusObject__c [for example] which contains Status__c. You can use a formula on your custom object - which will be the Activity__c.

Activity__c can be StatusObject__r.Status__c

In this case, you do not have to take the trouble of updating each time the Status is changed. The formula gets directly changed based on the Status.

SabrentSabrent

Thanks to Shruthi and Starz26 for you rresponses.