Apr 20 2022 07:54 AM
Hello, I am new to using Microsoft lists, but I am trying to make a better test request system. Each of our test reports are labeled by the following: "GTLB"-YR-index. The index resets every year. For example, the 18th test request we receive in 2021 will be labeled as GTLB-21-18. When 2022 rolls around, I want this list to automatically create the test-id and call it GTLB-22-01. Is there a way I can do this with Microsoft flow, as it doesn't look to be possible to refer to another row in the list within the actual list application. Additionally, we would like to keep the global ID (just called ID and automatically created and populated by sharepoint/list) and have it be visible in another column, in case we want to see how many tests we ran total, and to just keep a unique identifier.
Apr 20 2022 12:16 PM - edited Apr 21 2022 12:34 PM
Hi @GStanisic , I've run some tests and I believe it can be done if you add a couple of fields to your list( year and request number). Your Flow then uses a Get items action with the 'order by' set to (as an example) req_year desc, req_num desc, and the top count set to 1.
Next you can perform a condition action. If the integer value of req_year is less than the integer value of utcNow() formatted as yyyy it will increment by 1. You would perform similar logic on the req_num (which I've tested).
I've been able to generate incremental years and reference numbers in a single flow based off of a Form submission but not yet tried adding an item to the list (it's late here, and maybe I'll try an end-to-end tomorrow).
It definitely seems achievable from what I've tested. It's just a case of arranging the actions and logic correctly.