You need to sign in to do that
Don't have an account?
Akis Athanasiadis
Lightning component redirect to record
I have created a flow and a lightning component which run on new.
The flow creates a record and I want at the end of the flow to be redicted inside the record which was just created.
In the flow I store the new record's id as {!recordId}
The controller is:
The flow creates a record and I want at the end of the flow to be redicted inside the record which was just created.
In the flow I store the new record's id as {!recordId}
The controller is:
({ init : function (component) { // Find the component whose aura:id is "flowId" var flow = component.find("flowId"); // In that component, start your flow. Reference the flow's Unique Name. flow.startFlow("Internal_Requests"); }, handleStatusChange : function (component, event) { if(event.getParam("status") === "FINISHED") { var navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": "??????????", "slideDevName": "related" }); navEvt.fire(); } }, })
What do i set at the record Id though to be redicted in the new record?
All the threads I have found, provide specific Id which of course does not apply to our needs.
I am sorry. Looks like you are overriding 'New' button. So, definitely recordId will be not be present.
I am assuming you are talking about flow output variable whose name is 'recordId'.
All Answers
if recordId is output variable, above may work.
I referred this documentation and edited the code:https://developer.salesforce.com/docs/atlas.en-us.216.0.salesforce_vpm_guide.meta/salesforce_vpm_guide/components_using_flow_inputs_get.htm
but it does not work unfortunately. is there something I am missing here?
This is the cmp
If yes,
then
I am sorry. Looks like you are overriding 'New' button. So, definitely recordId will be not be present.
I am assuming you are talking about flow output variable whose name is 'recordId'.
I put your code for the component and I replaced the part that i needed to in the controller but I get error:
Uncaught Action failed: c:Supplies$controller$handleStatusChange [Cannot read property 'length' of undefined]
Callback failed: serviceComponent://ui.interaction.runtime.components.controllers.FlowRuntimeController/ACTION$execu
I did it and it is working now :D
Thank you very very much :D