function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
scottj2scottj2 

Bulk API

Do the trigger/validation steps have the same order of execution for the Bulk API vs. the regular API?  I have a trigger which does a lookup to populate a required realtionship field (ParentID on the Note object).  When using the regular API, the trigger fires before the validation, and the data is loaded properly.  But when using the Bulk API, I get the following error:

REQUIRED_FIELD_MISSING
Any ideas?
scottj2scottj2

Bit of a clarification:

 

It looks like the problem happens for both regular API and in the Bulk API. It *Doesn't* happen when creating objects directly in Apex code.  Thus, you don't get the error in my unit tests, since the trigger populates the ParentId field with a lookup.

 

But it looks like the external Salesforce API does some validation before the "before trigger" which denies the creation of the object, even before the trigger runs.  This really sucks for a dataload when at the time of the insert, the external system doesn't have a reference to the Salesforce ParentID (but it can easily be looked up within the trigger)