Hello, I'm trying to create a check list, with pickable values, the structure of the data goes, as for example:
-> Host
- Groups
Users
- Groups
Users
-> Host
- Groups
Users
When I'm cycling through the values I want to divide them by Groups, but before the name of the Group there should also be the name of the Host it belongs too, this is what I have:
Which results in this:
The value after the "Host:" is missing, how do I access the {{lookupObjects.Name}}?
Thank you
Hello, after some research I've found that this is a documented issue, and is currently on hold to be solved, here is the link to the issue:
First thing, I am not using Assets and so my suggestion is based on what I understand about rules. With the disclaimer out of the way...
Once you are inside of a rule iterator like {{#lookupObjects}} it can only see that information at that point, and lower. And so referencing {{lookupObjects.Name}} will not work inside that loop.
And also...you are trying to access the Host name inside of the {{#Groups}} iterator; it is no longer visible.
One alternative is to create a separate Host heading, and then add the lower level items.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've changed the format, so that instead of:
HostA - GroupA
HostA - GroupB
It's like this:
HostA
- GroupA
- GroupB
But now I have a different question, what if I wanted to compare a value to make it so it only renders the group and its option if Profile = Admin, like so:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the attribute is visible at that point, you can use list filtering and conditional logic for that: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588
Your change is close, and with a slight adjustment, and let's assume your Profile is defined in the Group, the change would be:
{{#lookupObjects}}
# Host: {{Name}}
{{#Groups}}
{{#if(equals(Profile,"Admin"))}}
--- **Group** - {{Name}}:
{{#Users}}
[x] {{Name}}
{{/}}
{{/}}
{{/}}
{{/}}
If your Profile is not in the Groups level, you may need to adjust your AQL to filter (if that is possible).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried with the code you sent me, but I'm not sure why it isn't working, none of the groups are showing up, so after that I wrote the value inside Profile, like so:
And this is what I got:
Not sure why the equals is not working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the type / structure of Profile? I suspect it may not be just text and instead has a lower level attribute that represents the "Admin" you are testing. You can confirm that by writing the entire {{lookupObjects}} result to the audit log. And once it is found, add the attribute to the filter.
For example, let's assume Profile has a Type, Name, etc. and the Name is the one you want. The filter would become:
{{#if(equals(Profile.Name,"Admin"))}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've also tried the .Name, and nothing is written down when I use {{Profile.Name}}, the value is a select value that only has 2 option, "Admin" or "NonAdmin"
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.
The images above are the field type and the selectable values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you see in the audit log if you write the entire {{lookupObjects}} to the audit log?
If it is a single-select as shown in the image, perhaps try this:
{{#if(equals(Profile.value,"Admin"))}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the audit log it only shows the Key of the Host, nothing more, also tried .value and 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've found this that might be related to the issue, but it refers to a custom field in Jira not Insight, https://community.atlassian.com/t5/Jira-questions/Using-String-Manipulation-functions-on-Select-List-Fields-Jira/qaq-p/1477939
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did this audit log to see what it returned, and everything looks normal:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you explicitly write just Profile to the audit log, I wonder if it is only showing the default attribute. That is why I suggested writing the entire thing as it would show the entire JSON structure: {{lookupObjects}}
We can also try some hackery...forcing the expression to text like this:
{{#if(equals(Profile.toLowerCase(),"admin"))}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just following up to check if this answered your question. If so, please consider marking this one as "answered". That will help others with a similar need find solutions faster. If not, please let the community know what help you need with the rule changes.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, after some research I've found that this is a documented issue, and is currently on hold to be solved, here is the link to the issue:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the link to the open issue, David.
There was a work-around noted for that ticket using created variables, but that may not help for your case while in the iterator (due to the other scoping problem with those).
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.