function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ty WhitfieldTy Whitfield 

Links with URL Parameters are stripped when sending to EmailMessage Object via API

I can successfully post an email to Salesforce using the EmailMessage Object, however when I send a link, something like below, it strips out a portion of the URL parameters.  See below 

Link sent
https://www.xxxxxx.com/en-us/reset-password?login=xxx@somecompany.com&id=441810

Instead, I get 
https://www.xxxxxx.com/en-us/reset-password?login=xxx@somecompany.com


Anyone know why or how to fix?
 
Best Answer chosen by Ty Whitfield
Ty WhitfieldTy Whitfield
Finally figured it out.  I had to encode and then decode.  Not sure I quite understand but is now working.

All Answers

Ty WhitfieldTy Whitfield
It is definitely the & in the URL.  When I substitute it for another ?, everything works correctly.  I've tried substituting the & with & and it still doesn't work.  Any other ideas?
Raj VakatiRaj Vakati
Can you use some URL encoing and send it and see ..  
Raj VakatiRaj Vakati
I have an couple thoughs 
  1. Use an URL Encoding and see i hope this will work 
  2. Send An third param i meane extra parma and see its excluding last param 

Now send like 
 
https://www.xxxxxx.com/en-us/reset-password?login=xxx@somecompany.com&id=441810&lang=en

If its excude the last param you have correct URL ultimately 
 
Ty WhitfieldTy Whitfield

Thanks for the response.  I've tried URL.Encode and that didn't work.  I also tried sending the third parameter and that didn't work.  Everything after the first & sign, is clipped.  If I change the & to a ? the rest of the email comes through with no problem.  

I tried sending an email directly from SF to myself to see what they have which was & and tried that but it didn't work.  It is something with the & sign and I can't figure it out.

Ty WhitfieldTy Whitfield
Finally figured it out.  I had to encode and then decode.  Not sure I quite understand but is now working.
This was selected as the best answer