I'm trying to update a percent complete field. There are three approvers and each one can approve at any time. I'm trying to add to this column and its previous value each time an approval comes through.
Ie. Supervisor approves -> i then update it to 33.3%, etc.
My first attempt I tried adding the 33.3 to the value of Percent Complete each time an approval comes through. Final approval would add 33.4. Seemed pretty straight forward but i get an error. Here's my workflow:
The approvals all work but i can't seem to get this running total going for all the approvals. For the adding i used this in the expression window:
- This should add the new value to whatever the previous value was.
The error i get is (error disaappears when i remove the adding function and workflow runs fine, but i'd like to have a running percent complete total working):
'InvalidTemplate. Unable to process template language expressions in action 'Update_item_3' inputs at line '1' and column '2643': 'The template language function 'add' expects its first parameter to be an integer or a decimal number. The provided value is of type 'Null'. Please see ...
Note: I'm doing the adding on a 'number' field within SharePoint (displaying as a percentage). I'm using another list to collect my approvals and then update and aggregate them together on a master list. I know there's easier ways to do approvals but this is what the requirements led us to build.
Hi there! I think this makes sense...Your condition path says "If this thing is null, add a number to it", but "null" is not the same as "zero" and the add function wants to see a number before it can add anything to it, right?
My suggestion (there are probably more elegant ways to do this) is to initialize a variable at the beginning and set it to zero. Then add the 33.3 to the variable in the path and update your % complete to the variable.
Another option would be to set the default value in your SP list for that field to "0", if possible.
Will that work?
If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.
I know the screenshot was very hard to see clearly (was trying to squeeze everything in). The test for null is testing the people field's for a value and it works. It will test that it's empty and then proceed to populate it if it is empty. If it isn't empty it means that they are approving the same item again for the a role that has already approved which would not be required and would be ignored.
The workflow only errors when i try and add to the value that is currently in the field, which would be zero by default.