This document provides a simple example of how a Salesforce Flow may be used to update a Case Status based on updates to the Issue Status received from Jira. In the example, Case Status is 'Closed' when an Issue is transitioned to 'Done'.
When an Issue Status is changed in Jira as a result of a workflow transition, the updated Status is sent to Salesforce to the ZIssue_c custom object provided with the zAgileConnect package. (Note: This assumes that the Issue Status field is shared with Salesforce). This Status update to ZIssue_c object can be used in a Flow to update the Case Status as needed.
In the Flow example below, all Cases related to a Jira Issue are transitioned to 'Close' Status when the Jira Issue status is transitioned to "Done".
To begin, we create a Flow that is executed on ZIssue__c update, retrieves all Cases related to that Issue, and performs an update on each of those Cases.
- Create a new Record-Triggered Flow for after ZIssue update event
- Add a Decision element to filter when Issue status is changed to Done
- Add a Get Records element to retrieve relationships from the junction object ZIssue_Case
- Add a Loop element to iterate over each relationship (the result of the previous Get Records element)
- Create a new Resource of type Variable to store a single Case record
- Add an Assignment element to set Case Id from the current Loop item and Status to Closed
- Create a new Resource of type Variable to store a collection of Case records
- Add an Assignment element to add the Case records to a collection
- Add an Update Records element to perform the Case status update
- Connect all the items
Please note that in scenarios where multiple Issues are associated with a Case, the first Issue transitioned to 'Done' will Close the Case independent of the Status of the remaining related Issues, since the example does not check for the Status of remaining Issues.