cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misc
Responsive Resident
Responsive Resident

Send collection to flow to get items from list

I'm struggling with JSON and need some help! I've tried to follow other forum posts as much as I can but still seem to be getting stuck.

 

I need to pass a collection through to Flow in order to reopen archived records.

 

I have a gallery in my app with a checkbox on each item, when the box is ticked the ID number of that record is passed to a collection called MissedCollection.

 

app.png

This data is then passed to a Flow via the 'submit missed collection' button

LabWasteReopenArchive.Run(JSON(MissedCollection))

This then shows up in my flow which currently looks like this:

jsonerror.png

The 'Get Items' action isn't working as it should though because of the {"ID":... bit around the actual ID number. My question is I think two-fold:

 

1) Is this the best way to get the IDs for each ticked record?

2) If it is the best way - how do I either remove the extraneous code I don't want so the correct record can actually be found?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
KvB1
Solution Sage
Solution Sage

You don't need a flow for this, you can just do it in the app. I would only consider making a flow if it will be a lot of items.

You can do something like: 

ForAll(
    Filter(
        Gallery.AllItems,
        Checkbox.Value=true
    ),
    Patch(
        DataSourceB,
        Defaults(DataSourceB),
        {
            ColumnA: ThisRecord.ColumnA
        }
    )
)

And then:

ForAll(
    Filter(
        Gallery.AllItems,
        Checkbox.Value=true
    ),
    Remove(
        DataSourceA,
        ThisRecord
    )
)

View solution in original post

6 REPLIES 6
KvB1
Solution Sage
Solution Sage

What does the reopen archived records look like? Maybe its kicking in open doors, but its always nice to check if a simpler solution is possible rather than trying to make a complex one work

misc
Responsive Resident
Responsive Resident

It is a record in a sharepoint list. Essentially, users submit a record for their waste to be collected which goes into our 'Live list', each month this is collated and sent to our supplier. When the data is collated it is then deleted from the Live list, and created in the Archive list and the process begins again.

 

What I've done with other similar projects (but not exactly the same hence why I'm stuck!) is have users select a certain record and 'reopen it' which runs a flow to essentially Get Item > Create Item (in Live List) > Delete Item (from Archive list). My thoughts for this flow was:

1) Button in app triggers flow

2) Multiple records are pulled into flow via collection

3) Use the ID to Get Items

4) Create Item (in Live List)

5) Delete Item (from Archive List)

But as you can see from my initial post, I'm stuck on 3.

 

It's all just above moving records from one list to the other, essentially. I hope that answers your question!

KvB1
Solution Sage
Solution Sage

So you select records in a gallery from list A, then you want to create an item in list B with those values, then remove the original item from list A that was selected in the gallery?

misc
Responsive Resident
Responsive Resident

Yes - that's a much simpler way of putting it 🙂

KvB1
Solution Sage
Solution Sage

You don't need a flow for this, you can just do it in the app. I would only consider making a flow if it will be a lot of items.

You can do something like: 

ForAll(
    Filter(
        Gallery.AllItems,
        Checkbox.Value=true
    ),
    Patch(
        DataSourceB,
        Defaults(DataSourceB),
        {
            ColumnA: ThisRecord.ColumnA
        }
    )
)

And then:

ForAll(
    Filter(
        Gallery.AllItems,
        Checkbox.Value=true
    ),
    Remove(
        DataSourceA,
        ThisRecord
    )
)
misc
Responsive Resident
Responsive Resident

Thank you @KvB1! That hugely simplified the process, much appreciated 😊

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,330)