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
Hugh Wheeler 46Hugh Wheeler 46 

The flow failed to access the value for sObjVariable.FieldName__c because it hasn't been set or assigned.

Hi there,

I am using flows quite heavily in an application, because we have so much regulatory compliance that changes often, I am putting the logic in flows and calling from process builder or apex.  The latest one I am working on is quite simple in theory.  I have to query about 50 fields on 1 custom object and use them to create another custom object or update it if it is there.  This is stuctured as follows:

1.  Sceduled apex kicks off a class
2.  Class Queries for all records changed
3.  Loops through each passing them into a flow.  The flow creates the new records and returns the record to the apex
4.  Once all records are processed, the apex upserts the list of all records.

My problem comes inside the flow when I have a custom text field (10) on each object.  If it is blank on the source object I get an error:

The flow failed to access the value for sObjVariable.FieldName__c because it hasn't been set or assigned.  

I found a useful hack in process builder to get around this kind of thing with lookup fields the other day where you insert a formula testing for null, and setting the field to null if it has no value.

This same workaround does not seem to work in flow.  No matter what I do I get the same error.

I have output everything in the calling apex and the field value is null, but the object i am passing into the flow is populated.  Someone must have run into this and solved it before.  Process builder seems to handle this kind of situation, but flow just dies.  Any assistance would be appreciated.