Skip to main content
Nintex Community Menu Bar
Solved

Generate unique instance ID

  • March 20, 2020
  • 10 replies
  • 728 views
  • Translate

Forum|alt.badge.img+4

Hey Nintex Community,

 

I've gotten a few requests to implement a unique per-instance ID so that individual approvals don't get confused. I found this solution for Sharepoint and tried to implement it in NWC, but the "InstanceID" variable I stored just output "fn-FormatDate({Common:CurrentDate},yyyy)-{ItemProperty:ID}" as a string rather than 2020-001 or however it's supposed to work. 

 

Screenshot of end result attached. 

 

How do I adapt this for the Cloud? Thanks :)

Best answer by butlerj

@jstraus I would do a regex action first to get the instance ID octet and store that in a new variable (in my example the variable ID):

 

 

Then in your email you can combine that with the Context variable for the Current Date:

 

This should give you the unique ID that you're looking for:

View original
Did this topic help you find an answer to your question?

10 replies

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • March 20, 2020

@jstraus as you discovered that particular runtime function combination won't work the same way in NWC as it did in SharePoint. However I think you should be able to use context variables to come up with a like typed solution. Take a look at my screenshots below and let me know if that's what you're looking for:

 

Task configuration

 

Task Email

 

If you're working with SharePoint Online, you will most likely also have an Item ID variable that you could use within your task to relate to the item.

Translate

Forum|alt.badge.img+4
  • Author
  • 13 replies
  • March 20, 2020

Thanks for the quick response @butlerj! That "instance ID" is a bit unwieldy. Is there any way to create a numerical ID that just increments up from 1, or something similar to that? 

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • March 20, 2020
@jstraus two questions:

1. Are these instances related to an item in SPO, or is this information entirely within NWC?
2. Are you trying to delineate between different instances of like typed tasks from different instances of the workflow, or are you trying to delineate between different tasks within the *same* instance of the workflow?
Translate

Forum|alt.badge.img+4
  • Author
  • 13 replies
  • March 20, 2020

@butlerj 
1. Entirely within NWC. I have a workflow set up to forward spend requests up the chain of command, the only external source the workflow links to is our active directory.
2. The former. Our Accounts Payable department is getting many requests in a given week, and would like a more specific way to differentiate between them than Project Name + Amount + Request Type. 

 

Now that I think of it, the date isn't strictly necessary. I just need to create some unique identifier that increments with each instance, so that when AP gets a request email it sasy "$1000 Task order for Anderson Project, ID: 123" followed by "$1100 Task Order for Anderson Project, ID: 124."  

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • March 20, 2020

@jstraus would something like "$1100 Task Order for Anderson Project, ID: 21103163." work?

 

I think we could easily trim the Instance ID using a Regex action at the start of the workflow that just pulls the first octet of numbers using this pattern: ^[^-]+

 

Let me know your thoughts.

Translate

Forum|alt.badge.img+4
  • Author
  • 13 replies
  • March 23, 2020

@butlerj That sounds like it would work! That'll be unique for every instance? 

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • March 23, 2020

@jstraus with how instance IDs work, it is technically the entire GUID that is unique each time, but even with the first octet of numbers you would have ~40,320 instances before you saw a repeat.

Translate

Forum|alt.badge.img+4
  • Author
  • 13 replies
  • March 23, 2020

@butlerj Understood. In that case it's probably best if I append the date as well, since this is intended as a long-term solution and the company might well go through several thousand instances a year. What's the proper command for adding the date, so it would read something like "ID: 20-03-23-21103163"? That way we could be 100% sure no repeats occur. 

Translate

butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • 260 replies
  • Answer
  • March 23, 2020

@jstraus I would do a regex action first to get the instance ID octet and store that in a new variable (in my example the variable ID):

 

 

Then in your email you can combine that with the Context variable for the Current Date:

 

This should give you the unique ID that you're looking for:

Translate

Forum|alt.badge.img+4
  • Author
  • 13 replies
  • March 23, 2020

@butlerj Awesome. Many thanks for your help. 

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings