cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dmistry
Post Prodigy
Post Prodigy

How to update a sharepoint list based on an item added/updated in another list in below use case

Hi,

 

I have a business scenario as follows:

I have one list called Request list where Employee fills in the new item form and earns a credit post approval through Flow.

Below is how it looks:

 

Request List:

Created By     Total Credit

User A              1

User A              1

User A              1

User B              1

 

Record list would look something like below:

 

Employee Name (Populated Already- Manually)           Total Credit

User A                                                                                     3

User B                                                                                     1

 

So whenever a user submits a request or item is added in the Request List then I want to update the Records list for a given user. It should also account for any update/modification in the Request list for a given user. Employee Name is manually populated in the Record list already so somthing like if Createdby matches Employee name then update total credit in Record list with respect to Total credit from request list. Please help me build this flow.

2 REPLIES 2
v-yuazh-msft
Community Support
Community Support

Hi @dmistry,

 

I have made a test on my side, and I would offer you a workaround.

 

I would default the trigger to add a item as a request on Request List, and check if the Record List has the Employee Name record.

If the Record List has the Employee Name recordadd 1 to the Total Credit column.

If the Record List doesn't have a the Employee Name record, then add an item to the Record List,and set the Total Credit column to 1.

 

I have created the sharepoint list as below:

Capture1.PNG

Capture1.PNG

The screenshot of the flow as below:

Capture1.PNGCapture2.PNG

 

The expression in the Filter Array as below:

 

@equals(item()?['Employee_x0020_Name'], item()?['Author']?['DisplayName'])

 

 

The expression in the Condition as below:

 

@equals(length(body('Filter_array')), 0)

 

 

The expression in the Condition 2 as below:

@equals(items('Apply_to_each')?['Employee_x0020_Name'], triggerBody()?['Author']?['DisplayName'])

The expression of the Total Credit column in the Update item action as below:

add(outputs('Compose'),1)

When add an item in the Request List as below:

Capture.PNG

The flow would run successfully as below:

Capture.PNG

 

The Record List would be updated as below:

Capture.PNG

Best regards,

Alice

Thanks a lot, much appreciated.

One question though, the CreatedBy field I mentioned in Request List is the OOTB SP field which displays name of the SP User who submitted the request.

 

In the record list, I have these SP user names prepopulated so what I want to do is, if the CreatedBy name let's say is User A for an added entry to the Request list then in the record list, it should add the respective value from Total credit column (from request list) to Total credit column of the record list for user A. Will this flow account for that.

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (30,851)