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
kabkab 

How can I fire the validation rule/trigger only on lead conversion?

Is there a way I can check in the validationrule/trigger to fire only at the time of lead conversion?

I don't want that to fire upon save.

 

thanks

K

Ispita_NavatarIspita_Navatar

Hi,                                             

Please refer to the following sample code to achieve your objective:-

                                             

trigger trigMapFieldsdata on Lead (before update)
                                            {
                                                  for(Lead lead:System.Trigger.new)
                                                    {
                                                         if (lead.IsConverted) // IsConverted is the property of lead.If its is coverted then it returns true.
                                                                 {
                                                                          // Custom business logic here....
                                                                 }                                        
                                                  }
                                             }

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

kabkab

I added condition but it did not work. It converted although the I added condiition to error out also tried with validation rule and still that did not work