Post

2 followers Follow
0
Avatar

Generate Guid

Is there any way to generate a unique Guid inside a Business Rule?

Specifically, I need to differentiate between two click of a custom action.  I know I could use a combination of user id, current object and time but this is not guaranteed to be unique.

 

Short of creating an object, grabbing the guid and then deleting it, is there anything I can do?

Josh Boutwell Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Josh,

There's currently no way of generating a GUID inside a business rule. However, if what you need is a unique identifier I can suggestyou try either of the following:

  1. Use a now time stamp (as a part of the identifier) as you suggested. If you use a tostring function with a format, tostring (now(), 'd/M/yyyy H:mm:ss:fff') for example, you'll be getting a milliseconds accuracy, which should be good enough.
  2. Use the GetNextCounterValue(counterName) (counterName is a string of your choice. I think there's a limit of 100 to the number of distinct counter names you can use per day) function to generate a new value per object the custom action is run on. This option actually creates/save a counter value so it may have an impact on performance, though probably insignificant. 

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink