You need to sign in to do that
Don't have an account?
trouble with custom button on Lead
Hello, all-
I currently have two custom buttons on my Lead object--one works, and one doesn't. Here's the code for the one that works (we'll call it Button A):
location.replace('/_ui/core/email/author/EmailAuthor?retURL=/{!Lead.Id}&rtype=00Q&template_id=00X50000001JK8x&p2_lkid={!Lead.Id}&p5=')
And here's the code for the one that refuses to work (blasted Button B):
location.replace('/_ui/core/email/author/EmailAuthor?retURL=/{!Lead.Id}&rtype=00Q&template_id=00X50000001JvXC&p2_lkid={!Lead.OwnerId}&p5=')
When I click Button B, I get the following error:
Unable to Access Page
Invalid parameter value "00550000001Xnnm" for parameter "p2_lkid".
Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.
Apparently, the Lead.OwnerId field isn't playing nicely--which would make more sense to me if the Lead.Id field didn't work flawlessly for Button A. Any ideas?
Many thanks in advance!
when you format new URL , use URLENCODE function ,
It will autometically replace unwanted characters
Thanks,
Bala
As follow
location.replace(URLENCODE('/_ui/core/email/author/EmailAuthor?rtype=00Q&template_id=00X50000001JvXC&p2_lkid={!Lead.OwnerId}&p5=&retURL=/{!Lead.Id}'))
Hope this will help you
Thanks,
Bala
Hi, Bala-
Sorry it took me so long to try this fix. I changed my code to yours and got this error message in a pop-up window when I clicked on the button:
A problem with the OnClick JavaScript for this button or link was encountered:
URLENCODE is not defined
I should also have mentioned before that I'm using a Detail Page Button with the Behavior "Execute JavaScript" and the Content Source "OnClick JavaScript." I tried changing the Content Source to a URL for your code, though, and still no dice--I got an error that said the URL was no longer available when I clicked on the button.
Other suggestions?
try this,
var url='/_ui/core/email/author/EmailAuthor?retURL=/{!Lead.Id}&rtype=00Q&template_id=00X50000001JvXC&p2_lkid={!Lead.OwnerId}&p5=';
location.replace( '{!URLENCODE(url)}' );
It should work,
Hope this will help you,
Thanks,
Bala
Thank you, Bala. For some reason, that code won't compile (or whatever the Salesforce term is for compiling)--I get this error when I click the "Check Syntax" button:
Error: Field url does not exist. Check spelling.