We will discuss how to map a custom Jira Status field to Salesforce Status field, and how to do automation to be able to change the Read-only Status field in Jira.
But first, there are some things needed:
Jira Status custom field (Select List -single choice).
Values must be the same on both sides.
If values are not the same, mapping is needed.
Make sure that the transitions between the selected statuses are available as per Atlassian Documentation. Else, the status in Jira will not change. Refer to the bottom of the page for more information.
This automation can be One way (Salesforce to Jira) and the first section will show that, Or Bidirectionally by adding and changing the sync direction of the mapping (shown in Complete the loop section).
1. Create a Custom Field
We will name it Jira Status and add the following Options(these options are the ones I have on my Salesforce instance. These values can be different, if they are, you will need to do value mapping and map the Salesforce Fields to their counter part in Jira)
Jira field values
Salesforce field values
We add the field mapping with Bidirectional Sync
If both sides have the same values, there is no need to do the value mapping.
If the values are not the same between Jira Status and Salesforce status, we need to do value mapping. (this is an example)
To change the Status field we use the following Automation rule.
First we need to create the rule in the cog icon → System → Automation → Global Automation
Then we create the rule and as first option we choose "Field value changed"
When : Value changes for Jira Status (Jira Status is the custom field we've created)
Now we add an If block and as many Else-if as necessary. This is per Jira Status value ( in this example we use 4)
The If block condition type should be "Issue Fields Condition" .
Inside the IF statement we add a THEN: transition the issue to (the first one on this example should be Backlog).
Another Else-if with Issue fields condition.
Inside the Else-IF statement we add another THEN: transition the issue to.
Another Else-if with Issue fields condition and another THEN: transition the issue to.
Keep adding them till you have all the statuses like this
After adding all the else-if blocks we need to turn the automation ON.
You can test if the automation works by changing the field in Jira. Change it to "Backlog" and the Status field should change to "Backlog". If the automation fails , check the automation audit logs.
At the end you will see that when you change the Status in Salesforce (Example: from Backlog to In Progress), it will change the Status Read-only field in Jira to that value.
Complete the loop
To have this automation both ways (Bidirectionally and get the Status field value into Salesforce), you need to change the Mapping sync direction like this:
With that configuration , the Status from Salesforce will be sent to the intermediary Jira Status field. The automation will match and change the Read-only Status Field to that value.
Then if you change the Status field in Jira, it will change the Salesforce field and the Salesforce field will update the intermediary field to the Same Status.
Hide Jira Status field from the Edit Screen
To avoid the misuse of the new Jira Status Field (since changing that field manually in Jira will change the Status field) we can hide it from the screen by using the Issue Layout.
Go to Project Settings → Issue layout
Select the Issue Type → Edit layout
Move the Jira Status field to the right (drag and drop)
Now the Jira Status field will be hidden .
"Destination status could not be resolved. If using a smart-value ensure this resolves to a numeric status ID or untranslated name for issues"
When creating the Automation rule you might encounter this error. To fix this you need to change the Actor in the Automation Rule into your user or any user who has permission to apply this transition.
This could also happen if the Actor is set to someone without the permissions for Automation.
In the Automation click on "Rule Details" and change the Owner.
Status does not change
After the Salesforce update, if the status in Jira does not change, it means that there is no transition step available for the selected status.
Check the Jira issues if a transition to the status is available. If yes, the status is shown in the drop-down list.
Click "View workflow" to view all available transitions of the statuses in the project's workflow.