[SalesForce] Pass a parameter to custom link/button

I have a custom button in my org that, when clicked, brings the user into an external application. That external application sends an email to other users with a link to the URL of that custom button via /servlet/servlet.Integration?lid={myButtonId}.

Is it possible to provide a parameter to this custom button?

To clarify, the custom button would look something like:

www.myExternalApp.com/view?id={someExternalValue}

So, within the email, I want to provide a link to the button that passes in someExternalValue:

www.na5.salesforce.com/servlet/servlet.Integration?lid={myButtonId}&someExternalValue=abc

Thus, when the user clicks the link, Salesforce launches straight to the URL of the custom button, and the value "abc" is passed in, so the resulting URL salesforce opens is myExternalApp.com/view?id=abc

Can this be accomplished somehow?

EDIT: As @Ralph states below, this does not seem to be possible. As a workaround for my use case, I created a visualforce page with an iframe tag which loads the same URL as the custom button, making it easy to pass the extra parameter to the page. This isn't ideal since I now have to maintain two components, but it gets the job done.

Best Answer

No, you can't do this with a custom button. Custom buttons are not intended to be used as links and probably won't work at all. The links from the custom buttons are the result of a post and just copying the link will lose other information that is passed a long with the button click.

Depending on your use case it sounds like you'll need a visualforce page. You're external system would send users a link to the visualforce page with whatever parameters you need to process on the salesforce side. Unfortunately, your use case sounds a little unusual and it may be better to ask a separate question about your specific use case rather than the more general can I pass in parameter question.

Note however, that if you want to pass in attributes from a salesforce record to the url resulting from a custom button this is easily done by editing the content source of a custom button.