Automation Rule: Smart Values Not Working for Issue Type Change
Asked by Sid007:

I'm facing an issue with a Jira Automation rule that's intended to trigger when an issue's type changes from "Bug" to "Related Bug." However, the automation isn't functioning as expected, and I'm encountering multiple issues:

1. **Smart Values Not Working** : The automation rule uses smart values to check the previous issue type (`{{fieldChange.fromString}}`). This smart value condition is supposed to match when the issue type changes from "Related Bug" To "Bug". However, the rule fails to recognize this condition, even though it appears correct.

2. **Issue Type Change Not Triggering**: Despite configuring the rule to trigger on changes to the issue type field, the automation rule does not trigger when I convert an issue type from "Bug" to "Related Bug." This is blocking the execution of the rest of the automation steps.

Here's a breakdown of the rule:

* **Trigger**: Value changes for the issue type field.
* **Condition** :
  * The smart value `{{fieldChange.fromString}}` is expected to equal "Bug".
* **Action**: Send an email notification when the condition is met.

I have verified that the issue type change is correctly happening from "Bug" to "Related Bug" on the issues, but the rule is not being triggered or logging the correct smart value in the audit log.

### **Questions:** {#toc-hId--2145701506}

1. Is there a known issue with using smart values like `{{fieldChange.fromString}}` for the issue type field in automation rules?
2. Are there any workarounds or alternative approaches to reliably detect when an issue type changes from "Bug" to "Related Bug"?
3. Could the problem be related to how the issue type field is handled in automation rules, especially when it's a custom field?

Any insights or suggestions on resolving this would be greatly appreciated!

![Screenshot 2024-08-26 193122.png](https://community.atlassian.com/t5/image/serverpage/image-id/343842iA25C07FBC8A162A5/image-size/large?v=v2&px=999 "Screenshot 2024-08-26 193122.png")


Answers:
author: Trudy Claspill
body: Hello [@Sid007](/t5/user/viewprofilepage/user-id/5576516)

Welcome to the Atlassian community.

Whenever requesting help with an Automation rule please provide the following:

* screen images showing the entire rule
* screen images showing details of each step that is not working as you expect, and any step that it depends on
* the output for the rule execution from the Audit Log.

Sometimes the location of the step within the rule is the cause of the problem. Other times there might be a typographical error. These can be determined only if we can see the rule.

I have these additional question:

1. What are the exact steps you are taking to "convert" the issue to a different type?

2. Is more than one field being changed during the conversion process? If multiple fields are changed within the process then the Field Value Changed trigger may not be triggered.

3. You asked if there could be a problem related to the "issue type" field being a custom field. There is a built-in field named Issue Type. Have you created a custom field with the exact same name? That could definitely cause a problem with Automation, depending on which one you are actually changing in the issue and which one you have selected in the Rule.

comments: author: Sid007
body: Other things are working fine and tested: Just that I cannot get the smart value to work. Tried multiple attempts on doing it as:

{{changelog.issuetype.from}} equals id

{{changelog.issuetype.fromString}} string equals "Related Bug"

{{fieldChange.fromString}}

etc- but doesn't work for me.(As you see in the screenshot)


author: Trudy Claspill
body: Hello [@Sid007](/t5/user/viewprofilepage/user-id/5576516)

There is no known issue with using {{fieldChange.fromString}} in a smart value condition. It works fine for me comparing such a value.

Your screen image does not provide any evidence that the condition does not work. That is why I asked if you would please provide both a screen image of your entire rule and the output for the rule execution log as supporting evidence.

You mentioned that the issue type change is not triggering the rule. I asked:
> 1. What are the exact steps you are taking to "convert" the issue to a different type?

I asked this because if you are using the Convert to Sub-task function or the Convert to Issue function, those indeed will not be recognized by Automation as a change to the Issue Type field and the rule will not be triggered.

There are reasons for the questions we ask. The information we request helps us debug your issue. Providing the requested information will enable us to get to the root cause faster.


author: Sid007
body: Yes, I'm using the Convert to Issue option since the issuetype changes from Subtask to a Bug. Maybe that is why the automation is not picking it up. Any way it can be set as such?  

Right now it looks like this since I'm trying to use it from: {{issue.changelog.isssuetype.fromString}}  

but Audit log says:  

##### [Advanced branching](https://compliancequest.atlassian.net/jira/software/c/projects/EXTCQPLM/settings/automate#/rule/21469845/579923798) {#toc-hId--1444548392}

The provided smart value was unable to be resolved to an object.

<br />

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/344391iB54EEDEEE21EF3A7/image-size/large?v=v2&px=999 "image.png")  


author: Trudy Claspill
body: According to the documentation for change log

<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/>

...the correct method for accessing the smart value for changelog is:

{{changelog...

Not

{{issue.changelog....

Also check out the example provided in that document for accessing the fromString attribute. The syntax is different than what you have.


author: Sid007
body: I have tried these all:  
Conditions  
{{fieldChange.fromString}} equals Related Bug  
Or  
{{issue.changelog.issuetype.fromString}} equals Related Bug  
Or  
{{changelog.issuetype.from}} equals 10000  
Or  
{{issue.changelog.issuetype.from}} equals 10000  
Or  
{{changelog.issuetype.from}} equals 10000  
Or  
{{changelog.issuetype.fromString}} equals Related Bug  

None worked.


author: Trudy Claspill
body: It does not appear that you observed this suggestion that I included.
> Also check out the example provided in that document for accessing the fromString attribute. The syntax is different than what you have.

Because your list of things you tried does not include the information from the documented examples:

<https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--changelog-->

![Screenshot 2024-08-29 at 9.26.00?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/344617i519C0E4F4BEE8BBE/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 9.26.00?AM.png")

Regardless, I have tried this example syntax myself using Log actions in a rule that uses the same trigger you specified (Field Value Changed for Issue Type or Parent), and using the Convert To Subtask and Convert to Issue functions.

![Screenshot 2024-08-29 at 9.40.38?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/344619iC03BD780869B46F8/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 9.40.38?AM.png")

While the rule is triggered it appears that the information for those fields is not written into to the Change Log accessible in the Automation Rule, when the Convert To functions are used.

This is what I got when I converted an issue to a Sub-task:

![Screenshot 2024-08-29 at 9.41.38?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/344620iF743A2B6F242F6F1/image-size/large?v=v2&px=999 "Screenshot 2024-08-29 at 9.41.38?AM.png")

And when I converted a sub-task to an Issue the rule was not triggered at all.


author: Duc Thang TRAN
body: Hello [@Sid007](/t5/user/viewprofilepage/user-id/5576516)

For me is correct your condition

Do you have only one condition, or do you have more conditions? If you have more conditions, can you try if else condition `?`

comments: author: Sid007
body: I have more, but i just want answer to using the smart values for issuetype history search.


author: Duc Thang TRAN
body: [@Sid007](/t5/user/viewprofilepage/user-id/5576516)

It working fine with these smartvalue for me .

Can you share the auditlog ? The trigger need to be "When field change" ![2024-08-28 14_13_16-Audit log - Automation - Scrum03 - Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/344244iDE43F87157A60707/image-size/large?v=v2&px=999 "2024-08-28 14_13_16-Audit log - Automation - Scrum03 - Jira.png")


author: Sid007
body: tried same, didn't work for converting an issue type from subtask to task issue type.


author: Duc Thang TRAN
body: Hello [@Sid007](/t5/user/viewprofilepage/user-id/5576516)

I haven't tested converting a subtask into a task yet.

From what I've found online, it seems that when converting a subtask into a task, you need to trigger a field value change for the 'parent field.

<https://jira.atlassian.com/browse/JSWCLOUD-22432>

However, it's strange that smart values like ***`changelog`*** or ***fieldChange*** don't seem to work as expected.


Tags: automation

cloud

jira-cloud