cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jasmine2020
Microsoft
Microsoft

Extract elements from array and then update their fields using Logic Apps

I wish to grab the elements in the Feedbacks array:

and then update two fields within that ids array:

 

 

 

   "Feedbacks":

                  [

                     {

                        "ids": "1234"

                    }

                   {

                        "ids": "4567"

                   }

                     

                 ]

 

update this:

 

"id": "1234"

"Features": 

       [

                {

             "id": "change this"

              "status": "change this"

               }

       ]

 

"id": "4567"

"Features": 

       [

                {

             "id": "change this"

              "status": "change this"

               }

       ]

 

 

 

I believe I may have to do this, does this look correct please, is this the correct approach?

Create two local variables that will update status and id.

I am seeing that I cannot dynamically put in the 'FeatureID' on variable 2 though because it is globally above the CDS step.

 

 

Does this appear correct? Any suggestion is appreciated. Thank you

jasmine2020_0-1597164922712.png

 

jasmine2020_1-1597164922716.png

 

 

2 REPLIES 2
PatrickMSFT
Community Support
Community Support

jasmine2020,

 

I might need a bit more background on this to comment properly.

 

First question, are you in proper Azure LogicApps for this or are you in Power Automate? They're very similar now but different enough that it could be a factor, many connectors behave differently and LogicApps tends to be more customizable. You may need to seek guidance from the appropriate forums if so.

 

You should just need to use a Filter Array step such as what is outlined here:
https://sharepains.com/2018/12/18/microsoft-flow-filter-data-in-an-array/

 

With your Feedbacks variable, assuming that is an Array type, you should be able to put that variable into a Filter Array and then you can pull specific information from it.

 

Another example of a similar approach:
https://powerusers.microsoft.com/t5/Building-Flows/Extracting-one-value-from-an-array-using-Select/t...

 

For even more:
https://docs.microsoft.com/en-us/power-automate/data-operations

 

Let us know!

 

Sincerely,
Patrick

Thank you Patrick, I will check out all the links you provided. Also, I am in proper LogicApp, not Powerautomate. I am not sure which forum to post to?

 

Here is a bit more information that I posted:

 

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.

jasmine2020_0-1597430959858.png

 

 

Feedbacks container looks like this: It has a Features array that contains an id that points back to the Feature it belongs to

jasmine2020_1-1597430959843.png

 

 

 

 

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.

 

jasmine2020_2-1597430959851.png

 

jasmine2020_3-1597430959854.png

 

 

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?

 

jasmine2020_4-1597430959849.png

 

 

(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:

jasmine2020_5-1597430959856.png

 

 

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?)

 

jasmine2020_6-1597430959857.png

 

 

I will be working on this and any insight is greatly greatly appreciated.

Thank you

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,209)