You need to sign in to do that
Don't have an account?

Urgent: using Javascript custom button issue
Hi All ,
I have created a custom with javascript functionality and its working fine . I want when the same button is pressed twice or thrice it should give alert message " Invalid action". I tried using lot of things but its not working. I know it looks very easy but pls help me out in this issue. Below is the script:-
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var leadstatus = '{!Lead.Status}';
if (leadstatus != "Z-Program Approved")
{
alert('An Elite Id cannot be assigned unless the Lead Status is equal Z-Program Approved');
}
else{
// Now calling the webservice to create a new Id
var callback = "" + sforce.apex.execute("CreateliteId","createlite", {LeadId:"{!Lead.Id}"});
// If create and update was ok - just reload Lead page to see the id of the elite partner
if(callback == 'OK' ){
alert('The Elite Id has been assigned');
window.location.reload();
}
else{
alert('Error: ' + callback);
}}
Hey ,
Its not working with this solution also. is it possible for you to do some modifications in the above code ?
Regards
And in your WebSer
Example
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
//Query the SysField__c from Object and check bellow Condition and update this SysField in your WebService Method
if('{!Lead.SysField__c}'=='true'){
var leadstatus = '{!Lead.Status}';
if (leadstatus != "Z-Program Approved")
{
alert('An Elite Id cannot be assigned unless the Lead Status is equal Z-Program Approved');
}
else{
// Now calling the webservice to create a new Id
var callback = "" + sforce.apex.execute("CreateliteId","createlite", {LeadId:"{!Lead.Id}"});
// If create and update was ok - just reload Lead page to see the id of the elite partner
if(callback == 'OK' ){
alert('The Elite Id has been assigned');
window.location.reload();
}
}
}else{
alert(' Invalid action');
}
Hi ,
when I execute the code with this method , All the time it is showing "Invalid action' . It is not executing the code in the IF condition. Any idea why this is happening ?
Regards