0

Usecase: We have installed a managed package which gives us the ability to redirect to a new page on a button press. In this case, the managed package searches for a list of companies in a register, and shows the results. We want to create a new account if one cannot be found.

The search page is hosted in a Visualforce tab, which is visible using Lightning. The button that they have provided on the page we can configure using setup functionality. When clicking the button, it can redirect to any link we need. In this case, I've tried /001/e?RecordtypeId=<Id here>. When trying this, it pops the new account page, however it doesn't populate the Id since salesforce has disabled url hacking for lightning (well in this case at least).

Looking for other creative ways to get around. I have tried the following:

  • Creating a visualforce page, and trying to use window.opener.$A to fire an event. This doesn't work since the visualforce page has no context of the lightning window, and thus window.opener == null
  • Create a visualforce page with a lightning out app in it and fire the event from there. This also doesn't work, as the lightning components parent is the vf page - which doesn't have access to the lightning window, thus can't find the e.force:createRecord action either.
  • Create a lightning app which just fires the event. This doesn't work as this just redirects to a new window, which also doesn't have the context of the window.

Anyone got any great ideas?

1

Managed to find a way. For those that are interested:

  • Create a component which can be put onto the page. In this component, put an event handler (on init) which you can use to call whatever you want using $A.
  • Create a lightning page - including the above component
  • Create a tab for that lightning page
  • Redirect from your VF page to /one/one.app#/n/<Lightning tab API name>

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.