web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow to delete seconda...
Power Automate
Unanswered

Flow to delete secondary SharePoint list item when status changes on Primary SharePoint list item

(0) ShareShare
ReportReport
Posted on by 1,133

Hello Power Users,
I have two SharePoint lists, Primary and Secondary. I am creating items in secondary list using subset of columns of primary list when "Status" column changes to Open. While am creating a item in secondary list, am referencing ID of primary list item as "Reference ID" in secondary list and using the same during the delete action. The flow for this is working fine. Now when status column in primary changes to "Closed", I would like to delete the corresponding list item in my secondary list. The flow for this is failing. Here is how my flow is looking. Can someone help.

 

FlowError1.JPGFlowError2.JPG

Categories:
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @RameshMukka 

     

    Please share screen of your complete flow.

     

    Thanks

    Hardesh

  • rameshmukka Profile Picture
    1,133 on at

    @Hardesh15 Here it is in detail. I have omitted other switch conditions as they are not part of the issue. I am also getting email triggered mentioned under "Closed". Just that the condition is failing before delete action. May be I am doing something wrong there.

     

    FlowError1.JPGFlowError2.JPGFlowError3.JPG

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @RameshMukka 

    Pls share length expression and also error message when you ran flow.

     

    Thanks

    Hardesh

  • rameshmukka Profile Picture
    1,133 on at

    Length expression : 

    length(body('Filter_array'))
     
    There is no error during the flow run. Here is output. The output body of the filter array is empty. And the condition is failing always. 
     
    FlowError4.JPG
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @RameshMukka 

     

    I have tested this at my end. it is working fine with zero in condition block.

     

    Thanks

    Hardesh

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @RameshMukka 

     

    Though your Filter output is zero and you are using condition " is not equal to" that is why it is going to in NO block.

     

    Thanks

    Hardesh

  • rameshmukka Profile Picture
    1,133 on at

    @Hardesh15 Thanks. I have changed the condition to "Equal to". But it deleted all items from secondary list. I just want to match the ID from primary list and "Refernce ID" from secondary list and delete the only match item from secondary list. 

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @RameshMukka 

     

    Yes it will delete all items because refrence id and item ID are always equal for all item in your logic.

     

    Use select action and store all reference id in it. Then use condition output of select contains ID.

    Do not forget to check select output format and set this kind of format in compose action for ID.

    It will work.

     

    Thanks

    Hardesh

  • rameshmukka Profile Picture
    1,133 on at

    @Hardesh15 In that case my sections Filter Array and Condition block are not serving any purpose. Can I remove them here. And include what you mentioned? But I never used select action as am a beginner. Do you have a sample how to use it here in my case?

  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @RameshMukka 

     

    You can setup like this. i used ID you need to put Reference ID there. And see compose action, i made output similar to Select action-

    1.jpg

     

    Thanks

    Hardesh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 335 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard