I am comng across an error that I am unsure how to solve. I am using force:recordData to update a field.
Component
<aura:attribute name="record" type="Object" />
<aura:attribute name="simpleRecord" type="Opportunity" />
<aura:attribute name="recordError" type="String" />
<aura:attribute name="fieldsToQuery" type="String" />
<force:recordData aura:id="recordEditor"
layoutType="FULL"
fields="{!v.fieldsToQuery}"
recordId="{!v.recordId}"
targetError="{!v.recordError}"
targetRecord="{!v.record}"
targetFields ="{!v.simpleRecord}"
mode="EDIT"
/>
Js Controller: (where field1 is a checkbox field)
({
doInit : function(component, event, helper) {
component.set("v.simpleRecord.Initiate_Scoring__c", true);
component.find("recordEditor").saveRecord($A.getCallback(function(saveResult) {
if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
alert("Save completed successfully.");
} else if (saveResult.state === "INCOMPLETE") {
alert("User is offline, device doesn't support drafts.");
} else if (saveResult.state === "ERROR") {
alert('Problem saving record, error: ' +
JSON.stringify(saveResult.error));
} else {
alert('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));
}
}));
},
onRender: function(component, event, helper) {
$A.get("e.force:closeQuickAction").fire();
},
})
However it is coming up with the following message:
[Error while creating content for lightning component quick action]
quickActionHandlerHelper.js failed to create component -
forceChatter:lightningComponent
Updated Question with the new error message.
Any Suggestions?