You need to sign in to do that
Don't have an account?
Tom Sine
Prevent Custom Button from being used more than once
This question may be very basic, but I am not a developer so my experience is very limited. I created a custom button to populate a date field in my object. Now I want to add to the code to prevent someone from using the button again. Below is the code for the button. What do I need to add to prevent the button from being used again?
- Thanks TS
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Custom_Quote_Request__c");
c.id ="{!Custom_Quote_Request__c.Id}";
c.Submit_Quote_Request_Date__c = new Date();
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();
- Thanks TS
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Custom_Quote_Request__c");
c.id ="{!Custom_Quote_Request__c.Id}";
c.Submit_Quote_Request_Date__c = new Date();
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();
var newRecords = [];
var c = new sforce.SObject("Custom_Quote_Request__c");
if(c.Submit_Quote_Request_Date__c =='')
{
c.id ="{!Custom_Quote_Request__c.Id}";
c.Submit_Quote_Request_Date__c = new Date();
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();
}
else
{
alert('Quote is already requestes');
}
You can do this by performing the below process
'
if(c.Submit_Quote_Request_Date__c =='' or c.Submit_Quote_Request_Date__c == null)
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Custom_Quote_Request__c");
if(c.Submit_Quote_Request_Date__c =='' or c.Submit_Quote_Request_Date__c == null)
{
c.id ="{!Custom_Quote_Request__c.Id}";
c.Submit_Quote_Request_Date__c = new Date();
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();
}
else
{
alert('Quote is already requested');
}