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

JavaScript on custom button

Hello  Guys,
                 I  am having a trouble while running a JS on my button . I have a button name Make Available on my detail page and there is a pick list name status which is by-default Pending. Whenever user click on Make Available button then the status would automatically change from pending to Available. Following is my code :-
var pro = new sforce.SObject('SPBE__Property__c'); 
pro.Id = '{!SPBE__Property__c.Id}'; 
pro.SPBE__Status__c= 'Available'; 
var result = sforce.connection.update([pro]); 
    alert('The Status Updated Successfully'); 
    alert('The Status Updated Unsuccessfully'); 

Prashanth KapparapuPrashanth Kapparapu
This code worked for me!!


var acc = new sforce.SObject("Account"); 
var F_Flag = '{!Account.F_Submit__c}';'{!Account.Id}'; 

if(F_Flag == true) acc.F_Submit__c="false"; 
else acc.F_Submit__c="true"; 

window.location.href = window.location.href;