You need to sign in to do that
Don't have an account?

How to get a button to mark a checkbox as true?
I am trying to create a button to check a checkbox as true so the workflow will activate. I keep getting the error 'TRUE" is undefined. This will be for our leads to be set up as an account.
------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
sforce.connection.sessionId = "{!$Api.Session_ID}";
var E = new sforce.SObject("Lead");
E.id = '{!Lead.Id}';
// Replace below with your field.
E.To_Be_Set_Up__c=true;
// save the change
sforce.connection.update([E]);
//refresh the page
window.location.reload();
All Answers
Please call the below VF at custom button, Just need to change EVENT with your OBJECT
<apex:page standardController="Event">
<apex:form >
<script src="/soap/ajax/32.0/connection.js"></script>
<script>
sforce.connection.sessionId = "{!$Api.Session_ID}";
var E = new sforce.SObject("Event");
E.id = '{!Event.Id}';
// update field : what is required for You
E.Count_Completed_Activities__c = 1;
E.Stage__c = "Call Closed";
E.Closed_Call__c = new Date().toISOString();
// save the change
sforce.connection.update([E]);
//refresh the page
window.location.reload();
</script>
</apex:form>
</apex:page>
Regards,
Pawan Kumar
<apex:page standardController="Event">
<apex:form >
<script src="/soap/ajax/32.0/connection.js"></script>
<script>
sforce.connection.sessionId = "{!$Api.Session_ID}";
var E = new sforce.SObject("Event");
E.id = '{!Event.Id}';
// update field : what is required for You
E.Count_Completed_Activities__c = 1;
E.Stage__c = "Call Closed";
E.Closed_Call__c = new Date().toISOString();
// save the change
sforce.connection.update([E]);
//refresh the page
window.location.reload();
</script>
</apex:form>
</apex:page>
If you are using java script button the use below code.
--------------------------------------------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
sforce.connection.sessionId = "{!$Api.Session_ID}";
var E = new sforce.SObject("Event");
E.id = '{!Event.Id}';
// Replace below with your field.
E.Count_Completed_Activities__c = 1;
// save the change
sforce.connection.update([E]);
//refresh the page
window.location.reload();
------------------------------------------------------------------------------------------------
If still any error, please share me your object API Name and Feld Api Name what you are trying to update. I will sahre you proper code.
Regards,
Pawan Kumar
Please share your code.
Regards,
Pawan Kumar
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
sforce.connection.sessionId = "{!$Api.Session_ID}";
var E = new sforce.SObject("Lead");
E.id = '{!Lead.Id}';
// Replace below with your field.
{!Lead.To_Be_Set_Up__c}=TRUE;
// save the change
sforce.connection.update([E]);
//refresh the page
window.location.reload();
------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
sforce.connection.sessionId = "{!$Api.Session_ID}";
var E = new sforce.SObject("Lead");
E.id = '{!Lead.Id}';
// Replace below with your field.
E.To_Be_Set_Up__c=true;
// save the change
sforce.connection.update([E]);
//refresh the page
window.location.reload();