I have created a lightning component which allows the creation of a record in a custom object. I've used lightning:recordEditForm to capture the data, and to help the user it automatically populates some fields on the custom object in the background when they submit the form.
<lightning:recordEditForm objectApiName="Object__c" onsubmit="{!c.onRecordSubmit}" onsuccess="{!c.onRecordSuccess}">
<lightning:inputField fieldName="Name" />
<lightning:button variant="brand" label="Save" type="submit" />
</lightning:recordEditForm>
When the user clicks submit, my logic sets a field value in the background (Field__c in this case), and then on a successful save redirects to the new record.
onRecordSubmit: function(component, event, helper) {
var eventFields = event.getParam("fields");
eventFields["Field__c"] = "Test Value";
event.setParam("fields", eventFields);
},
onRecordSuccess: function(component, event, helper) {
//navigate to new record on successful save
var navEvt = $A.get("e.force:navigateToSObject");
navEvt.setParams({
"recordId": event.getParam("response").id,
"slideDevName": "detail"
});
navEvt.fire();
}
This was working fine until this week (I think today 19/07), when we noticed that the field values being set in javascript were no longer being persisted in the newly created record. Is this an issue with Salesforce?
Field__c
in the markup but hide it with CSS... does that help? And if not, maybe you could manipulate thevalue
attribute of that field directly.