2

how to navigate to new record create a page with some default values as we do in a lightning $A.get("e.force:createRecord") in LWC

I have tried the below code, but not working:

           this[NavigationMixin.Navigate]({
                type: 'standard__objectPage',
                attributes: {
                    objectApiName: 'Corrective_Action__c',
                    defaultFieldValues: {
                        "Key_Action__c" : this.principlerecid
                    },
                    recordTypeId : this.correctiveActionId,
                    actionName: 'new'
                }
            },true);
4

This is a kind of limitation in Lightning web Component. Setting default values isn't yet supported, and planned for an upcoming release.

I have created one idea on this:- Allow setting pre-default values in record form by navigation service in LWC

You can upvote this. For time being continue using force:createrecord in your aura Component.

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.