
In Salesforce Classic you can just create a button to place on the layout (see below), but I can't figure out how to do the same thing as an Object Quick Action.
1 respuesta
I found a hack that I authored for my company earlier this year. Check it out:
Component:
Controller:<aura:component implements="force:lightningQuickAction,force:hasRecordId" access="global">
<aura:attribute name="recordId" type="String" />
<aura:handler name="init" action="{!c.doInit}" value="{!this}" />
</aura:component>
({
doInit: function (component, event, helper) {
var recId = component.get('v.recordId');
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/apex/YOUR_VISUAL_FORCE_PAGE?id=" + recId,
"isredirect": "true"
});
urlEvent.fire();
}
})
Just assign this lightning component as your quick action override, and then it should redirect to your visual force page. Similarly, you can use this hack in console by creating a new lightning record page, and making this the only component on the page. When the lightning page opens, itll automatically redirect to the visual force page you want to use. To do this, simply change the component declaration to:<aura:component implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName,flexipage:availableForAllPageTypes" access="global">
I hope this helps!
If this solves your problem, please mark this as the accepted answer. If you need help, just let me know.
Thanks!
Matt
Disclaimer! This is a hack, and is not officially supported by salesforce. Check releases for official solutions, or use a preview sandbox to confirm this works before each release.