You need to sign in to do that
Don't have an account?
Jeremy Hendy
Enhanced External Services - can't directly access sub-object in Flow Action
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.
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.
So I think Enhanced External Services is only useful if you have a pretty simplistic external API, and don't want to bring back large arrays of results.
I also figured out (not well documented anywhere) that execution time of your Flow seems to massively slow in Debug mode if you've got loops - or if you happen to have a Developer Console open in another window. I couldn't figure out why my flow seemed to take 1 minute for the first loop, 2 minutes for the second loop iteration, 3 minutes for the third, etc, etc - it was because I was using Debug mode.