cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CJ_SH
Regular Visitor

Update and Create SharePoint Item

Flow requirement:

1. Get User Profile of a Group's member

2. Compare if User Information already exists in SharePoint List or not

3. if not exists then create Item 

4 If exist than update the item with current Item.

 

 

Any suggestion on same !!

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @CJ_SH,

 

Could you please share more details about your SharePoint list?

 

I have created a SharePoint list on my side and the data structure of it as below:4.JPGNote: The User Principal Name (UPN) column, UserName column, Mobile Phone column and Email address column are all Single line of text type column. Each item has a unique User Principal Name (UPN) value, we would use this column (User Principal Name (UPN) column) to find the specific and unique item within my following flow.

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "List group members" action of Office 365 Groups connector, specify Group Id.
  • Add a "Apply to each" action, input parameter set to output of "List group members" action.
  • Within "Apply to each" action, add a "Get user profile (V2)" action, User (UPN) field set to User Principal Name dynamic content of "List group members" action.

         Add a "Get items" action, specify Site Address and List Name. Then add a "Filter array" action, From set to output of "Get items" action, Within Condition box, left input box set to User Principal Name dynamic content of the "Get items" action, right input box set to User Principal Name dynamic content of the "Get user profile (V2)" action.

 

        Add a Condition, click "Edit in advanced mode", type the following formula:

@empty(body('Filter_array'))

Within "If/yes" branch of Condition,add a "Create item" action, specify Site Address and List Name. The columns that you created set to corresponding dynamic content values of the trigger.

 

Within "If/no" branch of Condition, add a "Apply to each 2" action, input parameter set to output of "Filter array" action. Within "Filter array" action, add a "Update item" action, specify Site Address and List Name. Id field set to following formula:

item()?['ID']

Title field set to following formula:

item()?['Title']

The columns that you created set to corresponding dynamic content values of the trigger.

 

Image reference:5.JPG

 

6.JPG

The flow works successfully as below:7.JPG

 

8.JPG

 

 

Best regards,

Kris

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @CJ_SH,

 

Could you please share more details about your SharePoint list?

 

I have created a SharePoint list on my side and the data structure of it as below:4.JPGNote: The User Principal Name (UPN) column, UserName column, Mobile Phone column and Email address column are all Single line of text type column. Each item has a unique User Principal Name (UPN) value, we would use this column (User Principal Name (UPN) column) to find the specific and unique item within my following flow.

 

I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "List group members" action of Office 365 Groups connector, specify Group Id.
  • Add a "Apply to each" action, input parameter set to output of "List group members" action.
  • Within "Apply to each" action, add a "Get user profile (V2)" action, User (UPN) field set to User Principal Name dynamic content of "List group members" action.

         Add a "Get items" action, specify Site Address and List Name. Then add a "Filter array" action, From set to output of "Get items" action, Within Condition box, left input box set to User Principal Name dynamic content of the "Get items" action, right input box set to User Principal Name dynamic content of the "Get user profile (V2)" action.

 

        Add a Condition, click "Edit in advanced mode", type the following formula:

@empty(body('Filter_array'))

Within "If/yes" branch of Condition,add a "Create item" action, specify Site Address and List Name. The columns that you created set to corresponding dynamic content values of the trigger.

 

Within "If/no" branch of Condition, add a "Apply to each 2" action, input parameter set to output of "Filter array" action. Within "Filter array" action, add a "Update item" action, specify Site Address and List Name. Id field set to following formula:

item()?['ID']

Title field set to following formula:

item()?['Title']

The columns that you created set to corresponding dynamic content values of the trigger.

 

Image reference:5.JPG

 

6.JPG

The flow works successfully as below:7.JPG

 

8.JPG

 

 

Best regards,

Kris

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Kris( @v-xida-msft ) for your solution. I follow your mentioned steps and it works perfectly fine.

 

But if you can help me to understand the FilterArray action and its condition

@empty(body('Filter_array'))

 

 

Anonymous
Not applicable

Thank you, it works.

 

Since this solution was published we also have new triggers available for newlly aded and remover Teams group members.

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 (3,077)