You need to sign in to do that
Don't have an account?
Using Button to send email and change a field value on CASE
Greetings all and Happy New Year -
I'm attempting to provide a way for engineers to send an template email to some people that have sent in a new case via Email2 Case (we do not want to send email on all new cases). I have set up a button using:
Detail Page Button
Execute JavaScript - OnClick JavaScript
The selected behavior is View in New Window
The script I am using is:
location.replace('/email/author/emailauthor.jsp?retURL=/{!Case.Id}&p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00Xf0000000IQPO&p26={!Case.From_2__c}&p5=')
This script behaves as desired and sends the email I expect.
I have tried unsuccessfully to also make this script change a field value on the Case (checkbox) from False to True. So far I have tried:
&{!Case.Initial_Email_Sent__c}=true
&{!Case.Initial_Email_Sent__c}='true'
&{!Case.Initial_Email_Sent__c}=1
&{!Case.Initial_Email_Sent__c}=-'1'
and also via URL hack:
&00Nf0000000vKwV=1
&00Nf0000000vKwV=true .... etc.
where '00Nf0000000vKwV' is the custom field identifier.
Once I try to add the field change, things break. The errors I get are either that the URL is no longer valid, or there is a left hand error. Can this be done or am I whistling in the wind here?
Thanks!
Try this version:
Note: The problem with this approach would be, as soon as the button gets clicked, the record would get updated regarless of email sent or not.
Thanks,
Balaji
All Answers
Try this version:
Note: The problem with this approach would be, as soon as the button gets clicked, the record would get updated regarless of email sent or not.
Thanks,
Balaji
@Balaji -
Outstanding! Thank you very much for your help.
After removing a couple of spaces I found in your code, I was getting an error "Unexpected token ILLEGAL" so I copied it to MS Word and repasted it back intot Salesforce . I'm not sure what that did (if anything) but it is working fine now. I had something similar to what you provided, but just couldn't get it to work.
Thank you thank you!