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
Big EarsBig Ears 

Visual Workflow Collections problem - Flow unable to access item variable despite being set

I have a collection in a visualworkflow that is failing on the first decision element within the flow. I'm getting the following error:

FLOW_ELEMENT_ERROR|The flow failed to access the value for Item.Product_Family_Getter__c because it hasn't been set or assigned.

However, I am definitely setting the field and can see that the flow has it at an earlier point in the debug log:

Building the collection of Opportunity Line Items:
17:27:27.411 (411151510)|FLOW_VALUE_ASSIGNMENT|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|getDealItems|true
17:27:27.411 (411228209)|FLOW_VALUE_ASSIGNMENT|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|OpportunityLineItems|[{Name=Crest-ONE Comm- White Teeth ONE Connect, CurrencyIsoCode=USD, Id=00kg0000004G4MeAAK, License__c=Subscription, Product_Family_Getter__c=ONE Connect}]
17:27:27.411 (411251830)|FLOW_BULK_ELEMENT_DETAIL|FlowRecordLookup|getDealItems|1
Iterating through the collection
It can be seen that the Item definitely has the field "Product_Family_Getter__c" assigned
17:27:27.411 (411944263)|FLOW_ELEMENT_BEGIN|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|FlowLoop|Loop_through_Line_Items
17:27:27.412 (412846666)|FLOW_VALUE_ASSIGNMENT|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|Item|{Name=Crest-ONE Comm- White Teeth ONE Connect, CurrencyIsoCode=USD, Id=00kg0000004G4MeAAK, License__c=Subscription, Product_Family_Getter__c=ONE Connect}
17:27:27.412 (412858987)|FLOW_VALUE_ASSIGNMENT|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|Loop_through_Line_Items.currentIteration|0

However, I still get this error:
17:27:27.413 (413041600)|FLOW_ELEMENT_BEGIN|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|FlowDecision|Is_this_a_NOW_Item
17:27:27.414 (414510540)|FLOW_ELEMENT_END|9831cff0c4b4f94bdd20336c790e146f2a7e2ab-19d3|FlowDecision|Is_this_a_NOW_Item
17:27:27.421 (421733197)|FLOW_ELEMENT_ERROR|The flow failed to access the value for Item.Product_Family_Getter__c because it hasn't been set or assigned.||

What else should I be doing? I attach a quick picture of the section of the flow that's failing:
User-added image



Best Answer chosen by Big Ears
Mia Ellgaard 16Mia Ellgaard 16
Hi Andy
Seems others have reported it and it is now field as a known issue: https://success.salesforce.com/issues_view?id=a1p30000000T5DpAAK

I suppose one could add a record looup right after the loop element to get the actual record. It ought to be a superflous stepbut may be woth a try...

Mia

All Answers

Matt Sutton 7Matt Sutton 7
I had similar error messages when I was trying to reference ID's in sObject fields - I had to create them a Variables instead.   I added a Screen to show the values in the fields and though I knew it was being assigned the screen outpuit was always blank unless I used a text variable.

Matt
Big EarsBig Ears
That's good to know there might be a workaround.

However, that does seem like a bug to me, if sObject variables aren't accessible to the flow, even when they're accessible to the debug log and referenceable in the flow. Otherwise, what's the point of the SObject variables?
Matt Sutton 7Matt Sutton 7
Agreed - I am also stuggling to Validate and Deploy in production using them so more than a little disappointed 

I am waiting to hear back from Salesforce on this error "- You can't set the "dataType" field to "SObject" because your organization doesn't have the required permission.   "

I've asked them to give us permission in Production but not heard any progress on it yet. 

In the Spring Implementation guide it does say it is a Pilot though so thinking somehting to do with that
SObject Variable Overview—Pilot
Use an sObject variable as a container in the flow to store, update, and reference field values for a record.

Flow Designer Resources SObject Variable Overview—PilotUser Permissions Needed
To open, edit, or create a flow in the Cloud Flow Designer: “Manage Force.com Flow”
Note: SObject variables in a flow are currently available through the “Launch Flows from Workflow Rules” pilot
program. For information on enabling this feature in your organization, contact salesforce.com.


Matt


Big EarsBig Ears
I wonder if your issues are due to Summer '14 not having been released into Production, so any deployment using SObjects in flows will fail until then?
Mia Ellgaard 16Mia Ellgaard 16
@Big Ears I have a similar issue now, but I have narrowed it down to being when I try to access formula fields. As long as the fields are other types they work fine...
Big EarsBig Ears

Hey Mia,
 

That's interesting - The field I'm struggling with is a formula field, so that seems to correspond with your experience. I wonder why the formula fields aren't accessible? Must be a database issue, surely?

Andy

Mia Ellgaard 16Mia Ellgaard 16
Hi Andy
Seems others have reported it and it is now field as a known issue: https://success.salesforce.com/issues_view?id=a1p30000000T5DpAAK

I suppose one could add a record looup right after the loop element to get the actual record. It ought to be a superflous stepbut may be woth a try...

Mia
This was selected as the best answer
SilkcutzSilkcutz
I had to use a record look-up after the loop in the end. And agreed Mia - it is superflous. 
James Allen 4James Allen 4
I am experiencing this issue as well.  However doesn't adding a record lookup inside a loop violate the rule of not using SOQL inside a loop?  This could cause Bulkification issues.  Though I am still not sure how bulkified flows are in general.