Skip to main content
Hi- New to SFDC and tried to see if some examples exisited for this.  They did and the best I could find is below

 

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
  1. 4 oct 2016, 18:10
    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);
0/9000