I am temporarily storing changes to records in a Map by Id in my Lightning component
Markup:
<aura:component controller="MyController">
<aura:attribute name="changes" type="Map" default="{}" access="private" />
...
</aura:component>
JS Controller Code:
var changes = cmp.get("v.changes");
changes[recordId] = {
sobjectType: 'NAMESPACE__MyCustomRecord__c',
Id: recordId,
...
};
cmp.set("v.changes", changes);
var action = cmp.get("c.save");
action.setParams({
changes: cmp.get("v.changes")
});
Apex Controller:
@AuraEnabled
public static void save(Map<Id, SObject> changes) {
update changes.values();
}
When I invoke this the Apex save() method throws an
An internal server error has occurred Error ID: 1757078119-115612 (1843984413) Error