cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sany98
Helper I
Helper I

Remove row/record from sharepoint list

Hi all,

 

We have created a flow with Forms and Power Automate that adds new users to a sharepoint list. The list provides access to various Power BI reports for all users stored there. The flow works like this: A team leader uses Forms to add an employee to the sharepoint list. This goes to an manager for approval and when it is approved, the user is added to the list. Everything works as we want.

Now we want to create another flow (also with Forms and PA), but we want to use it to remove a user from the same sharepoint list and thus access to the BI report. We want to use the email address and department to match with the user to be removed from the list. It should go through the same steps as the flow when we add the user. This is beyond my knowledge so I am asking for help :).

1 ACCEPTED SOLUTION

Accepted Solutions
PrasadAthalye
Community Champion
Community Champion

Your flow should be similar like adding new item.

  • Declare a Variable to store ID to delete.

PrasadAthalye_1-1621389129739.png

 

 

  • Once your approval is done you can do Get Items with Department Filter.
  • Then on that output, use Filter Array to filter for users email. Refer Example Below

PrasadAthalye_0-1621389079594.png

  • Then SET the variable IDtoDelete using following expression
item('Apply_to_each')?['ID']

PrasadAthalye_2-1621389207724.png

  • Finally use variable in Delete Item to remove the entry from the list.

PrasadAthalye_3-1621389251357.png

 

 

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

15 REPLIES 15
PrasadAthalye
Community Champion
Community Champion

Your flow should be similar like adding new item.

  • Declare a Variable to store ID to delete.

PrasadAthalye_1-1621389129739.png

 

 

  • Once your approval is done you can do Get Items with Department Filter.
  • Then on that output, use Filter Array to filter for users email. Refer Example Below

PrasadAthalye_0-1621389079594.png

  • Then SET the variable IDtoDelete using following expression
item('Apply_to_each')?['ID']

PrasadAthalye_2-1621389207724.png

  • Finally use variable in Delete Item to remove the entry from the list.

PrasadAthalye_3-1621389251357.png

 

 

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Hi 

@PrasadAthalye 

I'm getting this error when I try to run the flow. I'm filtering Region instead of the Department.

 

The field 'Region' of type 'Note' cannot be used in the query filter expression.
clientRequestId: 106c9495-8547-4502-bd30-328fdec4e428
serviceRequestId: 106c9495-8547-4502-bd30-328fdec4e428

 

sany98_0-1621630504503.png

 

Okay. Why do you have Region field as Note OR Multi Line Text. Can you create that as Choice?

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Thank you @PrasadAthalye !

 

I have changed to single line and the flow runs successfully but the SharePoint line is not deleted. E-post and Region matches with the input from Forms.

 

sany98_0-1621697593054.png

 

sany98_1-1621697637056.png

 

sany98_3-1621697873865.png

 

 

Filter Array output is empty. Can you please upload output of GetItems? Does it return data?

 

If yes, Can you please use Compose before filter array and map it to Responders email and check the value? Then compare it with SharePoint list and see if matches correctly.

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

@PrasadAthalye 

You mean this one?

 

sany98_2-1621707881641.png

 

"ItemInternalId":"6","ID":6,"E_x002d_post":"sany@iss.se","Aff_x00c3__x00a4_rsomr_x00c3__x0":"3","Divison":"543","Region":"57656","Distrikt":"546","Driftomr_x00c3__x00a5_de":"988798","Kostnadsst_x00c3__x00a4_lle":"8978978","Kundgrupp":"09090","Modified":"2021-05-22T15:02:58Z","Created":"2021-05-22T14:53:33Z"

 

Okay. Can you use compose and map it to Responders email and upload the output?

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Sorry. I can not see the output. But does it exactly matches the email address that you are filtering? (sany@iss.se)

It appears to me like longer than the email address in the bracket... If its an array, you will have to split it and then compare.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

@PrasadAthalye Sorry, here is it again

 

sany98_0-1621849430116.png

 

sany98_1-1621849507389.png

 

Ok thank you. Email from logged in user is .com as seen above sany@iss.com and email from SharePoint is sany@iss.se.

 

So they have different domains so its not matching. You will have to update SharePoint to reflect .com.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

@PrasadAthalye 

Sorry, missed that completely . I have changed to the correct email in Sharepoint and now there is an output in filter array. Next problem 🙂 is that Set variable is failing.

 

Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '34578': 'The template language function 'item' must not have any parameters.'.

 

sany98_0-1621879983575.png

 

sany98_1-1621880051855.png

 

@PrasadAthalye 

 

I have tried to recreate everything from scratch, but same error. Any clue why?

Your expression of Set variable is incorrect. It should be items with s. refer example below.

 

items('Apply_to_each_7')?['ID']
Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
sany98
Helper I
Helper I

@PrasadAthalye 

It works now! Thank you for your help and patience!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,949)