+ Start a Discussion
deepak1.3956330618074822E12deepak1.3956330618074822E12 

Adding Case comments in javascript that invokes the mail client

I have difficulty in getting the case comments to the body of the email when invoked through javascript through a button. I have a custom button called Send Email and when clicked on Send Email, it opens the email client (In my case outlook). The To, CC, Subject are all filled through field reference in the javascript but i am not able to fill the body of the email with the last case comment that is public.
The javascript (Onclick Javascript under custom button) i have is as below

javascript:location.href='mailto:{!Contact.Email};{!Case.Additional_To_Emails__c}?CC=support@aryaka.com&SUBJECT=[{!Case.CaseNumber}] [{!Case.Subject}][{!Case.Ref_ID__c}] &BODY={!Case.Last_Case_Comment}';

{!Case.Last_Case_Comment} is not getting filled in the body of the email. Any suggestions to make it work?

Regards
Deepak
Pavan DavePavan Dave
Is Last_Case_Comment is having value all the time? Can you check by firing a SOQL on case object directly, if it have value or not?

If no then you can try creating a custom field, Last_Comment__c and get it populated every a case commnet created (by workflow on case comment).

Thanks,
Pavan
deepak1.3956330618074822E12deepak1.3956330618074822E12
Yes. The Last_Comment has value all the time.

Regards
Deepak
Pavan DavePavan Dave
If there any special character in the Last_Comment that may break the javascript from populating value in Body. 
Can you please check just putting "test" in Last_comment and click send email?
deepak1.3956330618074822E12deepak1.3956330618074822E12
Okay. Finally i was able to get it with the function JSINHTMLENCODE. Its working now :-)

Regards
Deepak