mercredi 6 juillet 2016

Salesforce - OnClick JavaScript custom button to email meeting notes fails with special characters

I’m having trouble getting text from the description field on the event page, to the body of a new email using JavaScript through a custom button. The custom button is called “Email Notes” and when clicked, it opens the default email client (In my case outlook) and copies the text from the description field, into the body of a new Outlook email. It also grabs the subject from the event in salesforce and brings it over to the subject line in an Outlook email. This works except for when there are special characters in the body of the meeting description in Salesforce. I noticed that if there is a % sign, it will be seen as ?0 in Outlook, or if there is an & sign, the button will not work at all. All other characters seem to come over just fine.

Here is the JavaScript (OnClick javascript under custom button):

javascript:location.href='mailto:?SUBJECT={!Event.Subject}&BODY=
{!JSENCODE(Event.Description)}';

I have tried

javascript:location.href='mailto:?SUBJECT={!Event.Subject}&BODY=
{!URLENCODE(Event.Description)}';

but the text that is carried over in Outlook has "+" signs in between each word. Perhaps there is a way to remove the plus signs?

Thanks

Aucun commentaire:

Enregistrer un commentaire