cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wimmste
New Member

How to update an item in a SharePoint list based on the changes from another SharePoint List?

I have two lists  a Person List and a Course List.

I need to count down 1 in the "Seats" Column when the "AC Date" is choosen in the Person List, so i know how many Seats are left in the course.

The "AC Date" Column is a lookup from Course List.

"ACDateLocation" is a Single line Text Column.

 

HR1.jpg

HR2.jpg

I would be very happy about your help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @wimmste 

 

Yes! So the flow currently counts down every time you have modified/created the item and there is any value in the courses column (Based on your request initially). For the dyamically changing values, you will have to build equivalent logic in the flow to count for events such as multiple edits on an item not related to the course lookup, change in the selection of the course lookup etc. 

 

In this case, I would suggest you to use a calculated field in sharepoint itself instead of using flow (to make things easier)

 

Hope this Helps! 

View solution in original post

8 REPLIES 8
yashag2255
Dual Super User II
Dual Super User II

Hi @wimmste 

 

Please refer to the screenshot below and replicateTas1.png

 

tas2.png

Expression used for Seats 

add(body('Get_item')?['Seats'],-1)

The ID in update Item is referring to the ID retrieved from the Get Item action. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Cool fast response thank you.

 

But whats the "length(...)" expression for the Condition ?

yashag2255
Dual Super User II
Dual Super User II

Hey @wimmste 

 

Sorry I missed that in the previous response, the expression used is 

length(triggerBody()?['Courer']?['Value'])

Here I am checking if there is some value in the lookup field. You can type length in the expression editor and select the Course Value from the dynamic selector (within the bracket of the length function)

 

Hope this Helps!

@yashag2255 

i get an Error in the Condition:

InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '1' and column '46741': 'The template language function 'length' expects its parameter to be an array or a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#length for usage details.'.

 

My Condition:

length(triggerbody()?['AC_x0020_Date']?['Value'])
 
My Flow:
HR3.jpg
yashag2255
Dual Super User II
Dual Super User II

Hi @wimmste 

 

Please update the flow condition as shown in the screenshotdd.png

Expression:

 

empty(triggerBody()?['Courer']?['Value'])

The condition is not equal to and the value on right side is true (type in the expression editor and select the value true)

 

Hope this Helps!

@yashag2255 

Thx for your patience, i am really new to this complex Flows 😉

 

The Flow is counting down everytime i am updating or adding a item in the person List.

It should be 4 Seats on all Items in the Course List.

 

Maybe i need a help column so the workflow knows that it already count down for that Item in the person list.

hr8.jpg

hr7.jpg

hr9.jpg

 

My Flow now:

hr10.jpg

 

 

yashag2255
Dual Super User II
Dual Super User II

Hi @wimmste 

 

Yes! So the flow currently counts down every time you have modified/created the item and there is any value in the courses column (Based on your request initially). For the dyamically changing values, you will have to build equivalent logic in the flow to count for events such as multiple edits on an item not related to the course lookup, change in the selection of the course lookup etc. 

 

In this case, I would suggest you to use a calculated field in sharepoint itself instead of using flow (to make things easier)

 

Hope this Helps! 

View solution in original post

Thx i will try that now.

Helpful resources

Announcements
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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (100,590)