Created
January 3, 2018 20:35
-
-
Save winniecluk/4e4f773ce89fee432812df899caf70e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- app event --> | |
| <aura:event type="APPLICATION" description="Used to Redirect to a Record within VF" > | |
| <aura:attribute type="String" name="recordId" /> | |
| <aura:attribute type="String" name="target" /> | |
| </aura:event> | |
| <!-- lightning component --> | |
| <aura:registerEvent name="redirectToRecord" type="c:redirecttorecord" /> | |
| <!-- lightning controller --> | |
| var redirectEvt = $A.get('e.c:redirectToRecord'); | |
| redirectEvt.setParams({ | |
| "recordId": event.target.dataset.id | |
| , "target": '' | |
| }); | |
| redirectEvt.fire(); | |
| <!-- VF page --> | |
| $Lightning.use("c:accountEquipmentApp", function() { | |
| $Lightning.createComponent( | |
| "c:accountEquipment", | |
| { recordId : "{!Account.Id}" }, | |
| "lightning", | |
| function() { | |
| $A.eventService.addHandler( | |
| { "event": "c:redirectToRecord", | |
| "handler" : redirectPage | |
| }); | |
| } | |
| ); | |
| }); | |
| function redirectPage (event){ | |
| console.log('inside redirect page on VF page'); | |
| var urlEvent = $A.get('e.force:navigateToURL'); | |
| var recordId = event.getParam("recordId"); | |
| var url = '/' + recordId; | |
| if (urlEvent){ | |
| urlEvent.setParams({ | |
| url: url | |
| }); | |
| urlEvent.fire(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment