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
Richard Pitfield 10Richard Pitfield 10 

I have created the below script for a button on the lead object

I have created the below script for a button on the lead object, it should tick the field Faculty Trial Request but doesn't any help appreciated, I've run this with for anotehr field Lead.Product in place of the Lead.FacultyTrial test field and it works fine.

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Lead");
if("{!Lead.Faculty_Trial_test__c}" == "no") {
alert("You can only request a Faculty Trial to SRM, Business or SAGE Video products. Pleae make sure you have added at least one of these products to the related Opportunity.");
}
if("{!Lead.Department__c}" == "") {
alert("You must add a Department to request a Faculty Trial.");
}
if("{!Lead.Email}" == "") {
alert("You must add an Email to request a Faculty Trial.");
} else {
c.id ="{!Lead.Id}";
c.Faculty_Trial_Request__c = false;
c.Faculty_Trial_Request__c = true;
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();}