I am using LWCs to display lightning cards in a list. The list shows information about Programs. Each Program card has a button, and this button needs to take the user to the 'new object' screen of the Application object. Here is my code:
applyToProgram(event) { // The recordTypeId is coming from the .html // I have verified that the value is correct. var rtId = event.target.id; // How do I use rtId below? this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Application__c', actionName: 'new', nooverride: '1', recordTypeId: rtId // This does not work } }); }
This is not working. The user is presented with the 'new object' screen for the object's default record type and NOT the one specified in rtId. I tried putting 'nooverride' and 'recordTypeId' in the state:{} argument, and I also renamed 'recordTypeId' to just 'recordType'. None of these worked.
Can anyone help me with the correct syntax? Is this even possible in LWCs?
Thanks, Jeff