
My goal is to have 2 buttons for Latitude and Longitude that when clicked, chnage the respective custom field. Ideally it would display on the button the actual values but first things first
SFDC throws and error on the bolded code below "Error: Field Current_latitude_c does not exist. Check spelling."
That is the API name of the field- here is the code
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
try{
var latitudeToUpdate = new sforce.SObject("Current_latitude");
latitudeToUpdate.Id = "{!Current_latitude_c}";
latitudeToUpdate.Enrollment_History_Trigger__c = true;
var updateResult = sforce.connection.update([latitudeToUpdate]);
if(updateResult[0].success === "true"){
location.reload();
}
else{
alert(updateResult[0].errors.message);
}
}
catch(e){
alert(e.message);
}
8 respuestas

This clears errors- is it valid?
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
try{
var latitudeToUpdate = new sforce.SObject("Current_latitude");
latitudeToUpdate.Id = !"{Current_latitude.Current_latitude_c}";
latitudeToUpdate.Enrollment_History_Trigger__c = true;
var updateResult = sforce.connection.update([latitudeToUpdate]);
if(updateResult[0].success === "true"){
location.reload();
}
else{
alert(updateResult[0].errors.message);
}
}
catch(e){
alert(e.message);