+ Start a Discussion
Antonio_hotelbedsAntonio_hotelbeds 

javascript code for a custom button not working


Hi!!

I have created a button that when the user clicks on it the value of a checkbox field is changed to true.

 

I created a checkbox field in the credit request called IsEmailSend.When the user click the button "send contact information"

I wrote a code that automatically changes this checkbox to true and then a workflow is fired and sends an email.

 

I have a problem with the code of the button. This is de code:

 

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

var update_CR = []; /*Declaring an array to pass the parameters */
var CR= new sforce.SObject("Credit_Request__c"); /* Declaring an object for the Credit request */
CR.Id='{!Credit_Request__c.Id}'; /*setting the ID of the object to the Id of the current credit request*/
CR.is_Email_Send__c = true; /* Setting the checkbox value as true */
update_CR.push(CR); /*pushing the updated object in queue*/
result_Update=sforce.connection.update(update_CR); /*updating the object*/
window.location.reload(); /* asking the page to refresh */

 

 

This button only updates the field IsEmailSend when Im logged as administrator, not when I am logged as any of my Sales Managers.

Could anyone help please?

 

Thanks!

Antonio_hotelbedsAntonio_hotelbeds

fixed!

 

I forgot about the permissions of the  field!

 

thanks!