sharepointconcatenationpower-automatecreateitem

Trouble using concat function in Power Automate


Trying to increment a Unique ID field in my SharePoint list every time my flow runs. Ex: If the Unique ID field in the last row before the flow runs again is "M10389". Then after the flow runs, a new item will be created underneath it and its Unique ID will be "M10390".

The only piece of the flow that doesn't work is the Unique ID part. Here are the pieces of code within the Unique ID field of the create item action block that won't work, but should.

I've tried: concat(string(M),add(10386,triggerBody()?['resourceData']?['responseId'])) and concat(M,add(10386,triggerBody()?['resourceData']?['responseId'])) P.S. The "triggerBody()?['resourceData']?['responseId']" is the number of submissions from the form that triggers this flow, and is how I am incrumenting the Unique ID field by one.

Neither work and I think it has something to do with the concat() function, because concat(m,n) doesnt work, neither does concat(string(M),string(2)), or even concat(string(m),string(n)). In fact, the only time concat works is when I'm using 2 numbers like concat(52,7).

The error message simply reads:

"us.flow.microsoft.com says The expression is invalid."

How do I achieve what I'm after within power automate?

Picture of what this looks like:

Picture of my flow


Solution

  • A bit similar to Muhammad's answer. Try using a variable, and set the value of the variable to "triggerBody()?['resourceData']?['responseId']".

    Then increment by 1 or any arbitrary number and use as needed.

    enter image description here