cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Flow formula for updating secondary list item in sharepoint

Hi All,

 

I'm having trouble completing a flow. I have two sharepoint lists, when a request for leave is approved in the first list, I want the corresponding employee's leave entitlement to reduce.

 

However, when I attempt to test the flow it fails: "InvalidTemplate. Unable to process template language expressions in action 'Update_item' inputs at line '1' and column '2569': 'The template language function 'sub' expects its first parameter to be an integer or a decimal number. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#sub for usage details.'."

 

The formula I am using is as follows; 

sub(items('Apply_to_each')?['Leave_x0020_Entitlement_x0020__x'],triggerBody()?['Working_x0020_Days_x0020_Leave'])
 
I am attaching screenshots of the flow so you can see more easily what I am trying to do and perhaps where I am going wrong.
 
Thanks,
 
AlexCapture.PNGsnip2.PNGsnip3.PNGsnip4.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @Anonymous,

 

First, the error message is that the output value of “items('Apply_to_each')?['Leave_x0020_Entitlement_x0020__x']”is empty, which obviously does not meet the requirements of the sub() function.

You could configure the Compose action in if yes branch first, and output the expression "items('Apply_to_each')?['Leave_x0020_Entitlement_x0020__x']" to see what its value is.

63.PNG

In addition, I suspect that 'Leave_x0020_Entitlement_x0020__x' is not the presentation of this field in Odata. You could use Get items to output the items of Employee's Leave Entitlement, observe how this field is represented in the Body, and then configure it in the formula.

65.PNG64.PNG

I think it is also necessary to check "Working_x0020_Days_x0020_Leave", using a similar method.

Please take a try and let me know if issue still exist.

 

Best Regards,

Barry

Community Support Team _ Barry
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

5 REPLIES 5
v-bacao-msft
Community Support
Community Support

Hi @Anonymous,

 

First, the error message is that the output value of “items('Apply_to_each')?['Leave_x0020_Entitlement_x0020__x']”is empty, which obviously does not meet the requirements of the sub() function.

You could configure the Compose action in if yes branch first, and output the expression "items('Apply_to_each')?['Leave_x0020_Entitlement_x0020__x']" to see what its value is.

63.PNG

In addition, I suspect that 'Leave_x0020_Entitlement_x0020__x' is not the presentation of this field in Odata. You could use Get items to output the items of Employee's Leave Entitlement, observe how this field is represented in the Body, and then configure it in the formula.

65.PNG64.PNG

I think it is also necessary to check "Working_x0020_Days_x0020_Leave", using a similar method.

Please take a try and let me know if issue still exist.

 

Best Regards,

Barry

Community Support Team _ Barry
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

Anonymous
Not applicable

Hi Barry,

 

 

I have tried what you said and the formula still doesn't seem to work

 

sub(items('Apply_to_each')?['keyj'],triggerBody()?['rfkn']
 
The quoted items are what I am given by the url of the columns and also if I hover my cursor over them on flow.
 
I am at a loss as to why the flow will not work.
 
 
Do you have anymore ideas?
 
Alex
Anonymous
Not applicable

Here are the screenshotssharepoint3.PNGsharepoint4.PNG

Hi @Anonymous,

 

I want to know the error message that is displayed when the Flow fails.

I noticed that the field name of the parameter of your formula is wrong. The screenshot is "kejy" "rkfn". The formula you provided is "keyj" and "rfkn".

Please check if this is the cause of the issue.

In addition, the type of these two fields needs to be Number type, preferably 1 decimal place.

Please adjust these and try again.

 

Best Regards,

Barry

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

Hi Barry,

 

 

I have made the adjustments but it still doesn't work. 

The error message I'm getting is the same one as before!

 

InvalidTemplate. Unable to process template language expressions in action 'Update_item' inputs at line '1' and column '2569': 'The template language function 'sub' expects its first parameter to be an integer or a decimal number. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#sub for usage details.'

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

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

Users online (17,549)