Missed Team ’24? Catch up on announcements here.

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

How do I compare the fromString and toString for just the parent value of a cascading select?

Rachel Bollinger October 21, 2020

I am automatically applying a comment when a cascading select value changes.  I only want the parent value to trigger the automation rule.  If the parent value stays the same and the child value changes, no comment is required.

To confirm the logic, I am creating a log as follows:

Operational Categorization Change: {{#changelog.Operational categorization}}{{FromString}} - {{toString}}{{/changelog.Operational categorization}}

The log is created.  An example is below:

Operational Categorization Changed Parent values: Application Program Interface (API)(22821) - Parent values: Application Program Interface (API)(22821)Level 1 values: Core API Call(22823)

However, I need to isolate just the parent value.  I was hoping to use smart values in an advanced comparison, but that is not working at all.

2020-10-21_10-45-25.pngIs there another way to accomplish this where just the parent value changes trigger or are the condition for the comment being applied?

1 answer

0 votes
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 28, 2020

Hello @Rachel Bollinger ,

That was a difficult but fun one to figure out, I did a bit of testing on this and there are a few locic layers to get around and break down, but I found a solution that should work for your requirements, but it does require a bit of overhead initially to get the values.

First off in my example values I used a custom field with the following hierarchy:

  1. Parent 1
    1. option 1
    2. option 2
  2. Parent 2
    1. option 3
    2. option 4
       

Screen Shot 2020-10-28 at 3.34.41 PM.png

The toString and FromString values are not going to work in the advanced compare using an {{issuse......}} as the timing of the toString and fromSting gets the value will already be the same when using the format, so regardless the value will be identical for both the to and from strings at the time of the call:

 {{issue.fields.customField_1234.value}}{{toString}} != {{issue.fields.customField_1234.value}}{{fromString}}

OR

 {{issue.fields.customField_1234.child.value}}{{toString}} != {{issue.fields.customField_1234.child.value}}{{fromString}}

Next, the Child value in the cascading list cannot be directly pulled outside the format {{issue.fields.customField_1234.child.value}} and you can only pull the full string for the field using the following format as a compare under a "When: Value changes for: field name" starting trigger:

{{fieldChange.fromString}}

OR


{{fieldChange.toString}}

the output for the field will display in the format:

Parent values: <Parent Name>(<Parent_ID>)Level 1 values: <Child option name>(<Child _ID>)

As an example using my test field, if the field was set to "Parent 1 > option 1" and changed to "Parent 1 option 2" the two strings would equal:

{{fieldChange.fromString}} = Parent values: parent 1(10541)Level 1 values: option 1(10543)

{{fieldChange.toString}} = Parent values: parent 1(10541)Level 1 values: option 2(10544)

So the solution I found requires getting all the values and ID's for the parent value and child option value then cycle through a if:else using advanced compare for each of the possible string variable outcomes.

To do this, you need to first get all the names and ID's for the field you can get these by looking at the URL for each option and then pump them into the formatting noted above OR a fas way I found to get this to work was to set up a comment to drop the values as you cycle through them like the following making sure the option is deselected for "Prevent duplicates by only adding this comment once to a particular issue."  so you can repeat the action:

  1. When Value Changes for
    1. your select list field
  2. if: Compare two values (advanced compare)
    1. {{fieldChange.fromString}}
      1. Does Not Equal
    2. {{fieldChange.toString}}
  3. Add Comment:
    1. GET THE NAMES AND ID's:
      fieldChange.fromString: {{fieldChange.fromString}}
      fieldChange.toString: {{fieldChange.toString}}

This will give you the values in a comment properly formatted as you change the values on a test ticket like this:

Screen Shot 2020-10-28 at 3.48.44 PM.png

now to trigger a comment using those values using a if:else automation again making sure the option is deselected for "Prevent duplicates by only adding this comment once to a particular issue."  so you can repeat the action for each level:

  1. When Value Changes for
    1. your select list field
  2. if: all match
    1. Advanced compare Condition 1
      1. First value
        1. {{fieldChange.fromString}}
      2. Condition
        1. equals
      3. Second Value
        1. Parent values: parent 1(10541)Level 1 values: option 1(10543)
    2. Advanced Compare Condition 2
      1. First Value
        1. {{fieldChange.toString}}
      2. Condition
        1. equals
      3. Second Value
        1. Parent values: parent 2(10542)Level 1 values: option 3(10545)
    3. THEN: Add Comment
      1. your comment
  3. ELSE: All match
    1. Input the same conditions as the one above cycling through the possible outcomes, noting the more outcomes you have the morte overhead will be needed using the fundamental counting principle. This principle states that if there are p possibilities for one event and q possibilities for a second event, then the number of possibilities for both events is p x q adding additiona events as an additional q#, i.e. p X q X q2.
    2. Example,
      1. I have 2 parents with 2 child options each so a total of 8 else statements are needed, 4 variable child options X 2 possabilities each
        1. parent 1 option 1 >
          1. parent 2 option 3
          2. parent 2 option 4
        2. parent 1 option 2 >
          1. parent 2 option 3
          2. parent 2 option 4
        3. parent 2 option 3
          1. parent 1 option 1
          2. parent 1 option 2
        4. parent 2 option 4
          1. parent 1 option 1
          2. parent 1 option 2

and would look something like this noting the else statements continued for 8 iterations:

Screen Shot 2020-10-28 at 4.19.25 PM.png

Hope this helps

Regards,
Earl

Rachel Bollinger October 29, 2020

Thank you, @Earl McCutcheon !  I believe I understand and will confirm when I have it working or whether I have any follow up questions.

Rachel Bollinger October 29, 2020

Thank you so much for this information.  I have 58 distinct parent/child values.  I'm able to make it work without configuring every possible combination as follows:

The first Advanced Comparison, I do on the fromString using contains, instead of equals.  I enter the parent value as the Second value itself.

The second part of the all match Advanced Comparison, I use "does not contain" and again enter the parent value as the Second value itself.

Here is an example:

2020-10-29_11-38-09.png

It's working like a charm!

Like Earl McCutcheon likes this
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 2, 2020

Hello,

Awesome! and thanks for sharing, that's a good one!  I'll have to add that one to my list of tips and tricks.

Regards,
Earl

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events