I am encountering some issues and it has me stumped, and hoping the community can help me out.

The aim here is that when the user pushes the custom button an alert should pop up saying:

"By Pressing Ok,The following will be sent to the external Provider"

When the user pushes the alert "okay" the Approve__c field set to true. If the User tries to push the button again and the Approve__c is set to true an other alert says "Already been sent to Supplier"

This is my OnClick JavaScript code. The button updates the approve field, however an alert isn't being presented.

var newRecords = [];
var c = new sforce.SObject("sales_and_marketing__c"); 
c.id ="{!sales_and_marketing__c.Id}"; 

if (c.Approve__c == 0) 
    alert('By Pressing OK,the following details will be sent to the external Provider'); 

c.Approve__c = true; 
result = sforce.connection.update(newRecords); 
  • 1
    Problem is that c.Approve__c is not actually queried from database. Only Id is. Try to get that from page (like {!sales_and_marketing__c.Approve__c}) or requery c object with that field included – kurunve Nov 14 '16 at 12:36
  • @kurunve - do you have a basic example I can refer to – Masond3 Nov 14 '16 at 18:36
  • try instead of if (c.Approve__c == 0) next: ("{! sales_and_marketing__c.Approve__c}"== 'false') – kurunve Nov 15 '16 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.