LogicApp that updates nested arrays within CosmosDB document
I have two different containers:
Features container and Feedback container.
Features container looks like this: It has a FeaturesID and a Feedbacks array that contains ids.
Feedbacks container looks like this: It has a Features array that contains an id that points back to the Feature it belongs to
I wish to change/update the contents within the Features array that belong to the Feedback container. The id within the Features array (which is in the Feedback container) point to the FeatureID that is in the Feature container.
In order to change/update the items within the Features array that is within the Feedback container, my approach was/is to:
To retrieve the Feedback ids where the state is "LinkRequested" and where the id is >15.
(This result tells me these are all the Feedbacks whose Features need to be placed into CRM)
This result gives me all the Feedback ids that point to the Features that need to be pushed to CRM. Then I must update their Features arrays 'ids' and 'state' with the new CRM id that was auto generated from CRM.
The output ids from this query are the ids that point to the FeatureID (in the Feature container) that need to be pushed to CRM.
To do this, would I need to perform a second query on this output to retrieve the actual FeatureID records?
(I was not able to do this above. I am having difficulty with how to retrieve the actual record from the first query that looks like this:
And then once these Features documents are pushed into CRM, I need to go back to the Feedback container and update the Features array within them to reflect the new ID that CRM has given as well as change the state name. (I think I can do this by parsing the data and filling in the actual document dynamically?)
I will be working on this and any insight is greatly greatly appreciated.