{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
if("{!$Profile.Name}" =="System Administrator"){
if("{!Opportunity.SOA_Sent__c}" == False){
if("{!Opportunity.Notification_POC_Email__c}" !== ""){
var OpportunityToUpdate = new sforce.SObject("Opportunity");
OpportunityToUpdate.Id = "{!Opportunity.Id}";
OpportunityToUpdate.SOA_Sent__c = true;
var result = sforce.connection.update([OpportunityToUpdate]);
if (result[0].success === "false"){
alert(result[0].errors.message);
}
else{
location.reload(true);
}
}
else{
alert("The Notification POC Email field cannot be blank!");
}
else{
alert("A SOA has already been sent for this Opportunity!");
}
else{
alert("You do not have permission to send SOA's!");
}
Give this a shot =
if("{!$Profile.Name}" =="System Administrator"){
if("{!Opportunity.SOA_Sent__c}" == false){
if("{!Opportunity.Notification_POC_Email__c}" !== ""){
var OpportunityToUpdate = new sforce.SObject("Opportunity");
OpportunityToUpdate.Id = "{!Opportunity.Id}";
OpportunityToUpdate.SOA_Sent__c = true;
var result = sforce.connection.update([OpportunityToUpdate]);
if (result[0].success === "false"){
alert(result[0].errors.message);
}
else{
location.reload(true);
}
}
else{
alert("The Notification POC Email field cannot be blank!");
}
}
else{
alert("A SOA has already been sent for this Opportunity!");
}
}
else{
alert("You do not have permission to send SOA's!");
}