I have this custom aura component that redirects to New Opportunity standard record creation with some fields pre-populated from Account record.


<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes,force:lightningQuickActionWithoutHeader">

    <lightning:navigation aura:id="navService"/>

    <lightning:pageReferenceUtils aura:id="pagerefUtils"/>

    <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>



  myAction: function (component, event, helper) {
    let navigate = component.find("navService");
    let pageRef = {
        type : 'standard__objectPage',
        attributes : {
            objectApiName : 'Opportunity',
            actionName : 'new'
        state : { }
    let defaultFieldValues = {
        Name: 'testing',
        AccountId : component.get("v.recordId")
    pageRef.state.defaultFieldValues = component.find("pagerefUtils").encodeDefaultFieldValues(defaultFieldValues);

But for some reason is redirecting fine to standard record creation but without pre-populated field values and not retrieving any error.

Is there something I'm missing when calling lightning:navigation


As per the documentation:

This component is not supported in Lightning Out, Lightning communities, or the Salesforce mobile app.

(my emphasis)

| improve this answer | |
  • So right now there's no away I can achieve this in lightning community with this or any other kind of implementation? Cause I need to pre-populate some values – molinet Mar 5 at 9:09
  • Try using Doug Ayers' legitimate URL hacking in LEX component. We use this to good effect. – Phil W Mar 5 at 9:15

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.