Based on the workflow expression created below, how can I can add/integrate it with update item in a SharePoint website?
Purpose: I would like to tell the SharePoint website that whenever a new row (every time add new item is clicked in edit grid view) is added, auto generate the next column (Reference Number (datatype numeric) value based on the previous value which for example is 10321.
reference_number column in descending order:
For example, let's say the last reference_number value is 10132 then, whenever the user clicks on add new item SharePoint should autogenerate the next reference_number which in this case would be 10133. Thus, each time add new item is clicked, the reference_number will be autogenerated by adding 1 to previous/last value.
How can I setup update item?
Error:
Unable to process template language expressions in action 'Initialize_variable' inputs at line '0' and column '0': 'The template language function 'add' expects its first parameter to be an integer, a float or a decimal number. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#add for usage details.'.
Expression:
add(triggerOutputs()?['body/reference_number'], 1)
Current workflow:
Updated workflow:




addfunction. Are you entering any value in "Reference Number" while saving list form OR you are trying to read the column value from last submitted item and then updated currently added list item?reference_numbervalue is10132then, when the user clicks onadd new itemSharePointshouldautogeneratethe nextreference_numberwhich in this would be10133. So each time ` add new item` is clicked, thereference_numberwill be autogenerated by adding1to previous/last value.