You need to sign in to do that
Don't have an account?
Can OnClick JavaScript run in System Mode?
I am trying to use a custom button w/ JavaScript to execute a record update for users who would otherwise not be able to edit the record, due to permissions and record sharing. However, when I click the button as a user without the proper edit rights on the record, nothing happens (except the page reload). It works just fine when logged in as SysAdmin.
Is it possible to get the javascript to execute without regard to the logged in user's edit rights on the record? If so, what am I missing? Code is below:
{!REQUIRESCRIPT("/soap/ajax/34.0/connection.js")}
var newRecords = [];
var c=new sforce.SObject("Contact");
c.id="{!Contact.Id}";
c.Referral__c="True";
newRecords.push(c);
result=sforce.connection.update(newRecords);
window.location.reload();
All Answers
window.location = '/_ui/core/email/author/EmailAuthor';
For a particular profile, I still want the "Send Email" check box - unchecked under the Profile > General User Permissions.
I am not familar on how to write a webservice class as proposed by the previous post. Can someone provide details on what my script should look like to allow this custom button to "runAs" either System or another user/profile that can send email utilizing the OnClick JavaScript method?