Reset Increment Variable for Sample ID - sharepoint-online

I am new to Power Automate flows. I was tasked to create a Unique Sample ID based on parameters from a SharePoint list, when an entry is created. I have created a SharePoint list, whose function is to hold the increment variable, which is my counter. The current flow increments this counter variable, whenever an item is created in the main SharePoint.
The Sample ID is suppose to reset every year based on the logged date of the incident, which is different than the stored date. For example, 2020SPI1, 2020SPI2, and 2021SPI1, 2021SPI2. I am trying to get an idea on how to do this.
I do not want a flow that resets the counter every year, since the stored date of the entry can be different from the date that the incident occurred.

In Order to make your format like 2020SPI1
Step 1: Initialize a vairable named as PatternId
Step 2: Set Variable. You can use string concat function in value of variable as following
concat(formatDateTime(utcNow(),'yyyy'),'SPI',items('Counter')
First argument here will produce current year: 2020.
Second argument is a static string: SPI.
Third your counter value from the list holding incremented number.
Then finally you can use PatternId to updated the id in your list column. Hope this can help you out.

Related

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:
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.
Well another approach to achieve the same could be two create two variables, one to increment unique id number part and second one is to compose the unique id. you can set value of uniqueIdNumbervariable using the Add function like you are already doing i.e.
add(10386,triggerBody()?['resourceData']?['responseId']))
Then you can set the value of second variable uniqueID by using another set variable action i.e.
M uniqueIdNumber
(you need to select 'uniqueIdNumber'variable from dynamic content, in set variable value action for uniqueID variable. )
Then you can use uniqueID variable in Create Item action.

SharePoint online reset ID number every year

I'm new in SharePoint online.
I've created a list, customized its form and flows.
But my question is aside from deleting the list to reset the ID number is there a way to reset it every year automatically without deleting the list? So that I'm not going to recheck and re-edit the form of the list.
Like for example today 2019 the ID count is over 500+ and by next year 2020 the ID number will reset into 1 or 0. So in short, ID number will reset every end of the year.
My list number is depending on ID number.
Example.
eNUM-2019-000
eNUM-2019-001
...
then for next year
eNUM-2020-000
eNUM-2020-001
...
In SharePoint Online, we can't reset the list item ID directly.
As a workaround, we can save the list as template and create new list base on the template in the new year begin.
Or you can create another Number column and maintain the ID in the new column.

Fetching date value from a SharePoint-list, to use in date&time specific field in flow

I'm trying to design a Microsoft Flow, which will create a outlook calendar event entry based on information in a SharePoint-online list.
The list will contain a value for a DueDate its a column of type Date, not including time.
I want to be able to create a outlook calendar entry on the date based off the duedate column. The calendar entry form in flow allows via dynamic content to add dates that also include time, however date columns not containing time cannot be added that way.
Is there a workaround to this, some expression that would allow me to fetch values from columns more freely and then possible append a time to it
I have tried converting the column in sharepoint to a Date with Time column and that workaround worked, however its not what I'm looking for. Id like to know how to be able to work around this because I don't necessarily want my column as a date-time column which can cause problems later on.
I have tried this expression:
formatDateTime(concat(item()?['DATE'], '08:00')'yyyy-MM-ddThh:mm:ss')
But I know this is wrong and it doesn't work. I'm simply not sure how to do it.
https://puu.sh/Df5ni/05cb882b23.png
I want the flow to add a calendar entry based off the due date column which i can append my own time to like the start of the day and last til the afternoon.
Actual results are I don't seem to be able to use a date column, just a date-time column for start and end times of the event, date column without time doesnt appear in the dynamic content list.
If there is some way to manually fetch values instead of using the dynamic content that is very powerful and can then possibly be converted to the right format using additional code.
Date column name in my list is date_without_time of type Date (Add time set to NO):
New element:
Function used in Create event (V2) action:
formatDateTime(triggerBody()?['date_without_time'],'yyyy-MM-ddT09:35')
Result:
Calendar:

Using a NetSuite saved search formula to filter from system notes

I am attempting to use a NetSuite saved search to bring back system notes for whenever an assigned person changes for a case. However, I would like to grab the initial assigned person and not the multiple re-assignments after that. Is there a way for me to only select the initial value rather than having all re-assignments come back to me? Is this able to be done from a formula somehow?
to get the oldest assignee of case you can use below criteria so, that results is restricted to just one result per case
1) System Notes : Field is assigned
2) System Notes : Old Value is empty
In the results add the column System Notes : New Value along with other columns of case. This field will pull the oldest assignee of the case
PS : solution assumes that there won't be any empty re-assignments. If there are empty re-assignments you should sort the results by Case unique identifier such as number or internalid and then by System Notes : Date, and the oldest date line would be the result that you are looking for.
Actually you can do that with a search clause where the old value is empty

SharePoint Calculated Field resets on item edit

I am using a SharePoint list that was migrated from an old Windows 2003 server to an existing 2008 server. This list is used to track issues raised by users against another application - a list of jobs to do if you will.
In the old list there was an Id field. When the list was recreated in the new area the assigned ID number was different, for example
Old ID New ID
--------- ---------
5 204
6 2
7 3
8 159
9 4
This assignment does appear to be fairly random.
To negate this a calculated column was created, so IDs raised before the migration use the Old ID number, and new calls raised after the migration use a calculated value. The calculation is
=IF(ISBLANK([ID (Old)]),ID+8,IF([ID (Old)]<=348,[ID (Old)],ID+8))
This compares the ID (Old) to blank, and if so, it is a new call and should have the default ID number, plus 8 (I think there was a total of 8 calls made during development that were then removed).
Otherwise if the Old ID number is less than 348 (the call number when we migrated), use the Old ID number.
If neither condition is met, simply set the ID to the new ID number plus 8.
This works fine when creating new calls.
The problem arises when I edit a call. For example if I set the ETA to a new value and save the call, the Calculated ID is always reset to 8.
I can fix this by going in to List Settings -> Opening the calculated column -> and clicking OK. This reapplies the calculation and everything is numbered correctly again.
For information - due to the environment this is deployed in I am not able to use SharePoint Designer at all.
The question is, how can I stop the renumbering when I edit an item?
The ID field behaves a bit oddly with calculated columns. A calculated column formula will find the ID of an item and resolve it properly when items are created or when the formula is modified, but as you discovered, when an item is modified, the formula can't find the ID value. (My guess is that this has to do with the ID field not being included in the list of column values being sent to the database on update, perhaps because the ID field should never change.)
One way around this is to use a workflow (or a custom event handler, if you have too much time on your hands) to copy the ID field to another column, such as a number or single line of text column, whenever an item is created. You can then use that new column in your formula instead of using the ID column.
To prevent people from updating your dummy ID column, you can hide it from the forms. To do this, first enable management of content types for the list, then edit the Item content type, find the new dummy ID column, and change it to "Hidden" (instead of "Required" or "Optional").

Resources