Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Getting values from the previous cycle

DavidBernardoSI1996
Contributor
September 27, 2023

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:

print1.png

Which results in this:

print2.png

The value after the "Host:" is missing, how do I access the {{lookupObjects.Name}}?

Thank you

2 answers

1 accepted

0 votes
Answer accepted
DavidBernardoSI1996
Contributor
November 6, 2023

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:

https://jira.atlassian.com/browse/JSDCLOUD-12834

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2023

Hi @DavidBernardoSI1996 

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

DavidBernardoSI1996
Contributor
September 28, 2023

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:

print3.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2023

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).

DavidBernardoSI1996
Contributor
September 28, 2023

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:

print4.png

And this is what I got:

print5.png

Not sure why the equals is not working

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2023

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"))}}

DavidBernardoSI1996
Contributor
September 28, 2023

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"

DavidBernardoSI1996
Contributor
September 28, 2023

print6.pngprint7.png

DavidBernardoSI1996
Contributor
September 28, 2023

The images above are the field type and the selectable values

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2023

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"))}}

DavidBernardoSI1996
Contributor
September 28, 2023

In the audit log it only shows the Key of the Host, nothing more, also tried .value and still nothing.

DavidBernardoSI1996
Contributor
September 28, 2023

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

DavidBernardoSI1996
Contributor
September 28, 2023

I did this audit log to see what it returned, and everything looks normal:

print8.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 28, 2023

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"))}}

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2023

Hi @DavidBernardoSI1996 

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!

DavidBernardoSI1996
Contributor
November 6, 2023

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:

https://jira.atlassian.com/browse/JSDCLOUD-12834

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2023

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).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events