Is there a way to create an automation that will create an issue and select one random insight asset to use in a field?
The asset needs to be random for compliance purposes.
Hi @DavidBernardoSI1996 -- Welcome to the Atlassian Community!
Although I have never done that before...I wonder if you could use a combination of features of automation for Jira features to do this:
Kind regards,
Bill
Hi thanks for the help, I've almost got the solution, there is just one last problem trying to access the index I want in a lookupObject.
First I'm creating a lookupObject, then I use the size of that lookupObject to get a random number between 1 and the total number of entries of the object, like so:
After that I use another variable to do minus(1) since a want a value between 0 to the size of the object -1 (to access the index)
Then when I'm creating the issue I'm trying to use the applicationIndexFinal to access the desired index in the lookupObjects:
But this is the part that is not working, when I create the issue both the {{lookupObjects}}, the {{applicationIndex}} and {{applicationIndexFinal}} write values on the description, but not the {{lookupObjects.get(applicationIndexFinal)}}.
Example:
lookupObjects will write: Server1, Server2, Server3
applicationIndex will write: 2
applicationIndexFinal will write: 1
And then nothing more is written.
How can I use the applicationIndexFinal to access the value I want inside the lookupObjects?
Note: I'm writing in the description for testing purposes the value should then be inserted in the application field bellow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe that get() for Lookup Objects takes a numeric parameter, so try converting with asNumber.
And...I think you can do the index calculation in one variable if you subtract after the CEILING() function in the math expression.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your fast response, I've already tried this:
{{lookupObjects.get(applicationIndexFinal.asNumber)}}, but still nothing :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wonder...unfortunately some smart value functions will not accept a created variable as a parameter. Let's try this...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems it doesn't allow the use of the created variable... Is there any work around?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Argh...this is one of those cases where a smart value function cannot take a variable (or smart value) as a parameter. I'll ponder a bit for other work-arounds, and until then you may want to work with your site admin to ping the support team about this one:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, haven't commented on this issue for a bit, but I've talked with support and there is a solution with the use of a lookup table with the lookupObjects and using the random function for the key. Thanks your help! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad to learn the support team offered an idea...and I believe the only reason that will work is Lookup Table's implementation of the get() function can take a parameter, unlike most of the other automation rule functions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@DavidBernardoSI1996 Can you explain how did you do it with lookup tables ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the long delay, but I've only seen the question about the solution today.
First get the list of assets from which you want to randomly select:
Then create a lookuptable, like so:
This is the code inside the Value field:
{{#=}}CEILING(RANDOM()*({{lookupObjects.size}} - 1)){{/}}
After that, to access the randomly selected asset use this:
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.