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
jagdish nikam 9jagdish nikam 9 

trigger scenario Example

Hi All,

Could you please give me 2 scenario with example where we can use trigger instead of workflow?

Please!!!
NagendraNagendra (Salesforce Developers) 
Hi Jagdish,

Here is the main difference between both of them 

Workflow:
1.You cannot create records
2..They currently can only result in a task, email, field update, or outbound message
3..They can only cross objects in a master-detail relationship, from the detail to the master, and only for certain scenarios (all custom to custom objects, some custom to standard objects, and even fewer standard to standard) https://help.salesforce.com/HTViewHelpDoc?id=workflow_cross_object_field_updates.htm&language=en_US

Trigger:
1.can do these things, but obviously using code
o2.ften needed for roll-up type scenarios where roll-up summary fields cannot be used
o3.ften needed when a record needs to be created on a different object
4.needed to kick off some apex code
many other reasons


For Example:::::::There is one field salary if u want that salary field value is greater than 50k and you want to if salary > 50k then system did not allow to enter that in this case, you have to write down before trigger but in same case u want to send the email to admin but allow to user to put value in salesforce u can write active workflow rule...

Please check with below link for more information. Regards,
Nagendra.