You need to sign in to do that
Don't have an account?
ifthikar ahmed
Trigger clarification
I am new to sales force
My trigger is for the Lead , PFB for the Trigger
trigger HelloWorld on Lead (before update) {
for (Lead l : Trigger.new){
l.FirstName = 'Hello';
l.LastName = 'World';
}
once after saving this when i go to lead and just select the record. immediately the f.name and l.name is getting changed to Hello world.... i have not even done any changes more over didnt click on the save button also..
To my understanding trigger shuld execute only if i make any change in the record or even while just viewing the record by clicking on its name itself will the trigger gets executed as it is a before trigger
My trigger is for the Lead , PFB for the Trigger
trigger HelloWorld on Lead (before update) {
for (Lead l : Trigger.new){
l.FirstName = 'Hello';
l.LastName = 'World';
}
once after saving this when i go to lead and just select the record. immediately the f.name and l.name is getting changed to Hello world.... i have not even done any changes more over didnt click on the save button also..
To my understanding trigger shuld execute only if i make any change in the record or even while just viewing the record by clicking on its name itself will the trigger gets executed as it is a before trigger
Please refer the lik below. The behaviour mentioned in the below link is intermittently observed in your scenario as well.
https://help.salesforce.com/articleView?id=000320742&type=1&mode=1
Please hit like if this suffice your question
I think you have some misunderstanding because you write a trigger on update event and it only fires when you update the Lead.
I try your code in my ORG and it works fine when I update the particular Lead.
For more info about trigger you need to follow the below link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi