0

We currently have a custom link on an Account page layout on Salesforce Classic. The link currently adds a Salesforce account to an external system. I would like for it to mark a checkbox on the account as true and then continue with the current step.

The link is currently set up with "behavior": display in new window and "content source": URL. The URL is using global variables like API.Partner_Server and API.Session_ID. From what I can tell, these can't be cleanly replicated within a controller. So I'm wondering if a custom link can be modified to handle multiple events. In this case, all we want to do is:

  1. mark a checkbox as true on the account if the link is clicked and
  2. continue with opening the URL on a separate page.

This is the current link URL value:

https://example.com/neWeb2/sf/lookup.aspx?sfUrl={!API.Partner_Server_URL_70}
&sfSession={!API.Session_ID}&cabinet=abc123&id={!CASESAFEID(Account.Id)}
&name={!Account.Name}&key={!CASESAFEID(Account.Id)}

If this isn't possible, is there another elegant solution to handle this that I might be missing?

2
  • 2
    What you have asked is not very clear as what you want to achieve. Can you edit your question a bit further to provide some more details. As what do you mean by "multiple events", etc.? And that if the link is on a standard page layout, or custom page. Is it LEX or Classic, etc. will help here. – Jayant Das Jul 31 '18 at 19:13
  • Done, thanks - hopefully it provides a bit more clarity. – mplax Jul 31 '18 at 19:55
1

As far as I can say, what you are trying to achieve is not possible using "Custom Link" with Content Source as URL. You won't have the control of the flow once the link has been clicked to make any updates on the record.

What you can instead do is as below:

  1. Create a custom button to invoke a VF page (Content Source - Visualforce Page)
  2. Within that VF page mark the checkbox on Account as true
  3. Open the external URL using apex:outputlink
2
  • Thanks Jayant. I ended up taking your route of using a VF page. On page load, I set some controller extension variables and then called an apex:actionFunction with JavaScript. The apex function updated the checkbox and returned a page reference to the original link. From what I could tell, this had to be done through JavaScript and couldn't just be an 'action' on the page because of the issue with the $Api global variables only being available through Visualforce. – mplax Aug 1 '18 at 18:20
  • Glad that it worked out for you! And thanks for providing the details on how you implemented it, will be helpful for others in the same situation. – Jayant Das Aug 1 '18 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.