• sandy18031985
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hello Everyone,

i have a custom button in my custom object where i am calling a java script. what it does is i gets the values and updates the custom field in the object. 

this working perfect in my laptop but in salesforce1 i cant see the custombutton. what i had read in documnets is that custom buttons are not supported in salesforce1.

i should use a publisher actions only for salesforce1. can any one please tell me how to use this in actions :

{!REQUIRESCRIPT ("/soap/ajax/34.0/connection.js")} 

if (navigator.geolocation) { 
var setPosition = function (position) { 
var visitId = "{!Visitas__c.Id}"; 
var userId = "{!$User.Id}"; 

//console.log("Latitude: " + position.coords.latitude + "\nLongitude: " + position.coords.longitude); 

var visit = new sforce.SObject("Visitas__c"); 

visit.set("Id", visitId); 
visit.set("Local_do_Check_In__Latitude__s", position.coords.latitude ); 
visit.set("Local_do_Check_In__Longitude__s", position.coords.longitude ); 
visit.set("Data_e_Horario_de_Check_In__c", new Date().toISOString() ); 

var result = sforce.connection.update([visit]); 

if (result[0].getBoolean("success") == false) { 
alert("Erro ao atualizar os dados da visita."); 

else { 
function redirect() { parent.frames.location.replace("/{!Visitas__c.Id}"); } 
redirect(); 
window.close(); 

}; 

navigator.geolocation.getCurrentPosition(setPosition); 
} else { 
alert("Este navegador não suporta geolocalização."); 
}


how can i use this in publisher actions. 


Thanks in advance 
hello guys i completed the challenge Create a process to update child record when the parent is updated. but i am still getting a worning saying that