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.
Is there another way to accomplish this where just the parent value changes trigger or are the condition for the comment being applied?
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:
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:
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:
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:
and would look something like this noting the else statements continued for 8 iterations:
Hope this helps
Regards,
Earl
Thank you, @Earl McCutcheon ! I believe I understand and will confirm when I have it working or whether I have any follow up questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
It's working like a charm!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.