+ Start a Discussion
Steven Berg 5Steven Berg 5 

How would I pass a trigger value to a javascript function?

I have a trigger on the contact object that checks if the phone field is updated using trigger.oldmap.get(phone)/ trigger.newmap.get(phone)
I would like to take that value say  newphonenumber and pass that value as a parameter to a javascript function where I can do a ajax jquery put call. If someone has a code example i would appreciate it. Thank You

Here is some psuedo code of what I would like to do:

trigger CheckPhoneNumberChanged on Contact (before update) {
If (trigger.oldmap.get(phone) != trigger.newmap.get(phone) )
                       newphonevalue= trigger.newmap.get(phone);
// call javascript function 
function passPhonevalue(newphonevalue) {

 type: "PUT",
data: { "Phone":newphonevalue }