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
Arif Iqbal 5Arif Iqbal 5 

Writing Trigger on Leads to update a record before insert

Hi Team,

I have a scenario on Lead Object. I want to write a trigger to do the following:
Ideally would like this to happen when we create the record before OR after Saving doesn't matter. I tried this with PB and worked fime but sime have implemented Duplicate management rules and there is a conflict with this PB hence disabled it and thought a trigger may be the way forward.

1. When a New Lead is created and the country on the standard Address fields  = United Kingdom it should update a field National_c = National
2. When a New Lead is created and the country on the standard Address fields  is NOT = United Kingdom it should update a field National_c = International
@anilbathula@@anilbathula@
Hi Arif Iqbal,

Is National__c is a lookup field or a text field?
If its a text field go with workflow instead of process builder.

Thanks
Anil.B
Arif Iqbal 5Arif Iqbal 5
National is a Picklist
@anilbathula@@anilbathula@
Hi Arif,

Try to correct the duplicate management rules to allow multiple records have same picklist values  .
other wise it will problem even you write a trigger also.

Thanks
Anil.B