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
Christopher DeFilippiChristopher DeFilippi 

Custom Button, Field Update

I am trying to create a button on a custom object so when clicked, it updates a checkbox field on the object. I am not a developer so I am reaching out to the pros! 
There are many ways to achieve this :
1. Using Ajax toolkit - refer this article for sample ( - However you may find problem in future if your organization is going with lightning experience.
2. This is better solution - Create a flow ( -  Use FIeld update element and open Flow from Custom button. This answer might be helpful for you (
Christopher DeFilippiChristopher DeFilippi

I'm not familiar with the flows but, I found a similar code from another article and revised it to what I need however, it is not working.  The code was built for the opportunity field update.


!REQUIRESCRIPT(“/soap/ajax/20.0/connection.js”)}  //soap connection call
var newRecords = [];  //declare the varaiable that will hold all the information
var coapp = new sforce.SObject(“Completed Application”);  //get the opp your on =”{Application_NameId__c}”; //get the id of the opp
coapp.Completed__c =”Submitted”;                // change a field
coapp.some_field__c ='File_Passed_To_Round_1__c‘) ; //create a custom field on your opportunity object called some field , (make sure it’s a text field).
newRecords.push(coapp);            //push the information through
result = sforce.connection.update(newRecords); //update the database with the information in the variable newRecords
window.location.reload(); // reload the page
I see Single quotes and double quotes while you copied are not correct. Can you try to type all single and double quotes again ? You can visit these short videos if want to learn flow ( . First video talks about record update using flow.

Below, I came up with :
var newRecords = [];   
var coapp = new sforce.SObject("Completed Application"); ="{Application_NameId__c}";  
coapp.Completed__c ="Submitted";             
coapp.some_field__c ="File_Passed_To_Round_1__c"  ;  
result = sforce.connection.update(newRecords);