+ Start a Discussion
StaciStaci 

custom button send email, insufficient privs

2 issues.  

#1 as an admin user the code below works fine.  If my Tier 2 guys try it, it says insufficient privs.  They do have the Send Email permission.  The Standard Send Email button in Accounts >Activities works fine.

#2 If I click the email button, and decide to cancel, it still makes the changes.  How do I account for cancelling?  
 
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
var solObj = new sforce.SObject("Solution"); 
solObj.Id = '{!Solution.Id}'; 
solObj.Status = 'Needs Update';
solObj.IsPublished = false;
solObj.Approved_checkbox__c = false;
sforce.connection.update([solObj]);

location.replace('/_ui/core/email/author/EmailAuthor?retURL=/{!Solution.Id}&p3_lkid={!Solution.Id}&p5=gilmore_staci@cat.com&p24=mansfield_matthew@cat.com&template_id=00X19000000QGBK');

 
Cyrus TalladenCyrus Talladen
What I would do, since you seem to have a custom button, is to make another custom cancel button which redirects back to the record detail page using javascript
 
location.replace('path/to/record')

similar to what this custom button was doing but not making any updates, just redirecting.

Cyrus T
www.levementum.com
StaciStaci
@Cyrus Talladen according to SF you can't edit the Send an Email layout that the URL calls so creating a custom Cancel button will not work.  Any other suggestions?
Cyrus TalladenCyrus Talladen
You can add javascript logic to your custom button, may a confirmation popup that says "Do you want to update the information?" and "Yes" would make the changes, and "No" would cancel the action.

Cyrus T
www.levementum.com