I am trying to prepopulate a field on record creation.For this,I have created Lightning component and a controller.
Lightning component code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<lightning:button label="Create an application"
onclick="{!c.createRecord}" />
</aura:component>
Controller:
({
createRecord: function(component, event, helper) {
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
"entityApiName": "Application__c"
"defaultFieldValues": {
'Name' : 'System Number',
}
});
createRecordEvent.fire();
}
})
But on saving controller,it throws the error:
Failed to save CreateapplicationrecordController.js: ESLINT_ERROR: {c:Createapplicationrecord – CONTROLLER} line:col [6:11] –> Parsing error: Unexpected token "defaultFieldValues" : Source
Name
in defaultfieldvales
is the API name of a standard field labelled as Number
. Data type is Text
.
Please help with this error.
Best Answer
You missed a comma and had an extra one: