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
Am123Am123 

Lead status

Hi,

 

Unless Lead status has a certain value, I need to prevent the user from converting it to an opportunity. How can I do this?

Shashikant SharmaShashikant Sharma

Two options for you

 

1) You can achieve this with this validation rule

 

AND(IsConverted , NOT( ISPICKVAL( Status , 'Closed - Converted')))

2) You can also write a trigger as well 

 

trigger validateConvertedLead on Lead (before update) { 

 for(Lead convertedLead: Trigger.new){
if(convertedLead.IsConverted == TRUE && convertedLead.Status != 'Closed - Converted')
{               
convertedLead.addError('Lead Can not be Converted');
}

}
}

 This Validation Rule and Trigger both will only allow only "Closed - Converted" Lead Status to be converted.

 

Let me know if any issues in it.