I have a component with a lightning:recordEditForm that I build using an aura:iteration over fields from a field set for Order Products. I've added a custom submit method in my controller that makes sure that all required fields have values:

var fields = evt.getParam("fields");
fields.OrderId = cmp.get("v.recordId");
fields.PricebookEntryId = cmp.get("v.currentFs").pbeId;
fields.Product2Id = cmp.get("v.currentFs").prodId;
fields.Quantity = 1.00;
fields.UnitPrice = 0.00;

When I fill out the form and submit in my component, though, it gives me an error that when I log it to the console says I have a field integrity exception on UnitPrice because "Order Products must have a unit price."

I just moved this component from a scratch org into a company sandbox, and I didn't have this issue in the scratch org. I've tested to make sure my value actually gets saved to the fields variable, and I don't know where else to check for what's wrong.

What else might be a factor in this?

  • check for validation rule if any. your scratch org might be missing the validation rule. Apr 22 '19 at 14:22
  • I hadn't thought about that, but I don't have any validation rules on UnitPrice. Apr 22 '19 at 14:47

@Ashish Sharma made a comment about validation rules breaking the form, and it prompted me to check workflow rules too. I had a rule that populated the value of UnitPrice with a value from a field that did not always have a value, and it looks like that was the issue.

  • Great, you were able to fix it. Please close the thread by accepting your answer. Apr 22 '19 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.