0

I have a list in a SharePoint website that will grow/update as data entries are made.

Purpose: I would like to tell the SharePoint website that whenever a new row is added, auto generate the next column (Reference Number (datatype numeric)) value based on the previous value which for example is 10822.

I found a workflow on Google using Power Automate however, I am getting an invalid expression error.

Power Automate workflow:

enter image description here

Expression:

add(outputs(`Reference Number`),1) 

How can I fix this?

1 Answer 1

1

It depends a bit on your setup.

If this expression is within an apply to each loop you could use:

add(item()?['ReferenceNumber'],1)

Otherwise it would probably be something like:

add(outputs('Name_of_Action')?['ReferenceNumber'], 1)

All these examples assume that your column is of type number. Otherwise you probably also need to add an int() function around the column to be able to add +1

When the property needs to be retrieved from a trigger action you can use:

add(triggerOutputs()?['body/ReferenceNumber'], 1)
4
  • In that case it probably is: add(triggerOutputs()?['body/ReferenceNumber'], 1)
    – Expiscornovus
    Sep 30, 2022 at 15:18
  • So once I save the workflow, whenever I click on add new item on the SharePoint website, it will autogenerate the column value in the new row, right? Or do I also need to add Update Item to the workflow or anything else?
    – Ed_Gravy
    Sep 30, 2022 at 15:24
  • 1
    What your flow currently does is retrieve the existing value of that column and increment it with 1 in the variable. Nothing is written back to SharePoint unless you tell the flow to do that ;) You would have to use the update item to actually write it back to the SharePoint item.
    – Expiscornovus
    Sep 30, 2022 at 15:28
  • I am getting an error with the expression provided in the edited answer. For more info, kindly look at this question.
    – Ed_Gravy
    Oct 1, 2022 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.