You need to sign in to do that
Don't have an account?
Santhiya Durai 2
Navigate to newly created record in lightning component
Hi,
I need to create a Quote from Opportunity using Quick Action. Once new quote is created it should navigate to newly created quote record page. Record is getting created but navigation to Quote record is not happening.
Component:
Controller:
Can anyone please correct me what I made wrong?
Thanks!
Regards
Santhiya
I need to create a Quote from Opportunity using Quick Action. Once new quote is created it should navigate to newly created quote record page. Record is getting created but navigation to Quote record is not happening.
Component:
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId"> <lightning:navigation aura:id="navigation"/> <div class="slds-page-header" role="banner"> <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Opportunity"> </lightning:recordViewForm> <lightning:messages/> <div class="slds-align_absolute-center" style="height:5rem">New Quote</div> </div> <lightning:recordEditForm aura:id="myform" objectApiName="SBQQ__Quote__c" onsubmit="{!c.handleSubmit}" onsuccess="{!c.handleSuccess}"> <lightning:messages/> <lightning:inputField fieldName="Invoice_To__c"/> <lightning:inputField fieldName="Ship_To_Location__c"/> <lightning:inputField fieldName="Multi_Site_Quote__c"/> <div class="slds-m-top_medium"> <lightning:button label="Cancel" onclick="{!c.handleCancel}" /> <lightning:button type="submit" label="Save" variant="brand"/> </div> </lightning:recordEditForm> </aura:component>
Controller:
({ handleCancel: function(cmp, event, helper) { $A.get("e.force:closeQuickAction").fire(); }, handleSubmit: function(cmp, event, helper) { event.preventDefault(); var fields = event.getParam('fields'); fields.SBQQ__Opportunity2__c = cmp.get("v.recordId"); cmp.find('myform').submit(fields); }, handleSuccess: function(cmp, event, helper) { var params = event.getParams(); var quoteId = params.response.id; console.log(params.response.id); component.find("navigation") .navigate({ "type" : "standard__recordPage", "attributes": { "recordId" : quoteId, "actionName" : actionName ? actionName : "view" //clone, edit, view } }, true); } })
Can anyone please correct me what I made wrong?
Thanks!
Regards
Santhiya
use the concept of page reference.
Refer this similar ask :-
https://developer.salesforce.com/forums/?id=9062I000000IFsbQAG
Thanks!
The following Function will solve your Problem, PLease give a like once Done.