1

We use Salesforce Manufacturing Cloud for our business. We create a VF page show SalesAgreementProductSchedule record and edit those records.

To get and update records, we use JavaScript Remoting.During test, we found follow weird behavior in Salesfoce.

If we send SalesAgreementProductSchedule like { PlannedQuantity: 48, ID: 0YC8b0000008SDiGAM }, Salesforce Database.update throw error and we can not update this record. But if we put ID at first field in record like { ID: 0YC8b0000008SDiGAM, PlannedQuantity: 48 } we can success update this record.

I want to ask you why cause this behavior? Is there any document about it?

1 Answer 1

0

We found solution base on Salesforce document: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_SObjectType.htm

In this document has follow content: enter image description here

So we change our code as follow:

if (hasId) {
    newSObject(id);
} else { 
    newSObject();
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .