• Jeremy Hendy
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I'm using Flow with Enhanced External Services to bring data in from an external API with a nested object structure including an array of items.

The 200 response from my API returns a top level object called "data" which includes a couple of numeric variables, and then an array object called "items".

I want to loop through the data.items sub-array, so I created a Collection variable of Apex Class FolderListAPI_data_items to hold that array of values.

Flow throws an error  "FlowApexObject cannot be cast to class common.apex.runtime.SObjectRow" error if you try to assign a the Collection Variable to the item array directly from the 200 output of the Action block.

{CollectionVariableDataItems} = {!GetFoldersAPIAction.200.data.items}

It appears to work only if you first create a Flow Variable for your top level Apex Class, assign that to the 200 output of the API Action, and then assign the Collection variable from that intermediate top level Apex Class variable. 

{ApexClassVariableTopLevel} = {!GetFoldersAPIAction.200}
{CollectionVariableDataItems} = {!ApexClassVariableTopLevel.data.items}

This doesn't make a lot of sense to me, but there you go.
I'm using Flow with Enhanced External Services to bring data in from an external API with a nested object structure including an array of items.

The 200 response from my API returns a top level object called "data" which includes a couple of numeric variables, and then an array object called "items".

I want to loop through the data.items sub-array, so I created a Collection variable of Apex Class FolderListAPI_data_items to hold that array of values.

Flow throws an error  "FlowApexObject cannot be cast to class common.apex.runtime.SObjectRow" error if you try to assign a the Collection Variable to the item array directly from the 200 output of the Action block.

{CollectionVariableDataItems} = {!GetFoldersAPIAction.200.data.items}

It appears to work only if you first create a Flow Variable for your top level Apex Class, assign that to the 200 output of the API Action, and then assign the Collection variable from that intermediate top level Apex Class variable. 

{ApexClassVariableTopLevel} = {!GetFoldersAPIAction.200}
{CollectionVariableDataItems} = {!ApexClassVariableTopLevel.data.items}

This doesn't make a lot of sense to me, but there you go.
I hae a flow that is returning this error after a pause.  Can you help me understand why this would be occuring?

Error Occurred: This error occurred when the flow tried to look up records: Questionnaire_Number_of_Returns__c, Owner:User FROM Lead WHERE ((Id = '00Q1800000Bmhk1EAB')) ^ ERROR at Row:1:Column:52 unexpected token: ':' (Bind variables only allowed in Apex code).
I'm using Flow with Enhanced External Services to bring data in from an external API with a nested object structure including an array of items.

The 200 response from my API returns a top level object called "data" which includes a couple of numeric variables, and then an array object called "items".

I want to loop through the data.items sub-array, so I created a Collection variable of Apex Class FolderListAPI_data_items to hold that array of values.

Flow throws an error  "FlowApexObject cannot be cast to class common.apex.runtime.SObjectRow" error if you try to assign a the Collection Variable to the item array directly from the 200 output of the Action block.

{CollectionVariableDataItems} = {!GetFoldersAPIAction.200.data.items}

It appears to work only if you first create a Flow Variable for your top level Apex Class, assign that to the 200 output of the API Action, and then assign the Collection variable from that intermediate top level Apex Class variable. 

{ApexClassVariableTopLevel} = {!GetFoldersAPIAction.200}
{CollectionVariableDataItems} = {!ApexClassVariableTopLevel.data.items}

This doesn't make a lot of sense to me, but there you go.