You need to sign in to do that
Don't have an account?
sunny@99-chg
How to Restrict the convert lead in Sobjects
Hai All,
How to restrict the convert lead after click on convert button in lead (Sobject)
suppose if status picklist contains "Approved"
Need: I have to restrict to convert lead if Lead status is not "Approved" and to show message "Can not to convert".
and then if lead status is "Approved" and now to make a field as required(i.e for particular field data must.),then to convert.
Can anyone suggest me how to do this..
Hi,
The issue is the picklist value should be refering to prior value use below:
AND(
OR(
ISCHANGED(ConvertedAccountId) ,
ISCHANGED(ConvertedContactId)
),
IF(ISPICKVAL( PRIORVALUE(Status), "open-not contacted"), TRUE, FALSE)
)
All Answers
Sunny,
Create a custom button called "Convert" on lead with Display type as "Detail page button", Behaviour: "Execute JavaScript", Content Source:"Onclick Javascript"...
then copy paste the below javascript code...
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}
var result = sforce.connection.query("select Id, Status from "+
"Lead where Id='{!Lead.Id}'");
var records = result.getArray("records");
//var user = sforce.connection.getUserInfo();
var URL = "/lead/leadconvert.jsp?retURL=%2F"+records[0].Id+"&id="+records[0].Id;
if(records[0].Status !='Approved'){
alert("Lead Cannot be converted");
}else{
window.location = URL;
}
Hi,
Simple configuration solution is you can create a validation rule on Lead in which you can say condition as
If ConvertedAccountId or ConvertedContactId is changed and the value is not blank
and the lead status picklist contains "Approved" show a message stating "Lead cannot be converted in APproved status"
Please tweak the validation rule condition according to the requirement.
Hai sam,
Thanks for ur reply....
Actually i need the functionality on lead after click on convert button...not in vf page.
That to already Convert button is there in lead records...
Hi,
The solution I am proposing is just creating a validation rule and you dont need to do any coding.
Create a validation rule in Lead object with the conditions I have provided in previous post.
Hope this helps.
Please come in gmail for chat if you need more help on this (vriavm@gmail.com)
Hai Visvanathan,
Thanks alot for your reply
As i already sent you my code to your mail..
Again i am posting my validation,but it is not working...
IF(( ISCHANGED(ConvertedAccountId )|| ISCHANGED(ConvertedContactId )) && ISBLANK( Email ) && ISPICKVAL( Status , 'open-not contacted') , true, false)
please suggest me.
Hi,
The issue is the picklist value should be refering to prior value use below:
AND(
OR(
ISCHANGED(ConvertedAccountId) ,
ISCHANGED(ConvertedContactId)
),
IF(ISPICKVAL( PRIORVALUE(Status), "open-not contacted"), TRUE, FALSE)
)