# Syncing Closure of Jira User Story, ServiceNow RITM, and Task

**URL:** <https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140>\
**Category:** General Questions\
**Tags:** snow, jira\
**Created:** [January 21, 2025, 2:19pm UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140 "2025-01-21T14:19:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/javier/32/338_2.png) [@Javier](https://community.exalate.com/u/Javier)\
**Post date:** [January 21, 2025, 2:19pm UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140/1 "2025-01-21T14:19:43Z")

</div>

I’m integrating Jira with ServiceNow and need help ensuring that when a User Story in Jira is closed, the related RITM and the associated ServiceNow Task also close automatically. I’ve tried some solutions, but they haven’t worked, so could you help me figure out how to make this happen?

---

<div class="post-metadata">

**Author:** ![Javier](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/javier/32/338_2.png) [@Javier](https://community.exalate.com/u/Javier)\
**Post date:** [January 21, 2025, 4:23pm UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140/2 "2025-01-21T16:23:42Z")

</div>

To synchronize the closure of a Jira User Story (US) with a ServiceNow RITM and the associated Task, follow these steps:

1. **Outgoing Sync in Jira** : Add a rule in Jira’s outgoing sync to ensure the User Story’s status is sent to ServiceNow when it is closed. You can set this rule as follows:

```auto
replica.status = issue.status 

```

1. **Incoming Sync in ServiceNow** : Update the incoming sync rules in ServiceNow to handle the status change. When the User Story is closed in Jira, the RITM and Task in ServiceNow should also close. If you have an existing status mapping in your synchronization rules (refer to this [documentation](https://docs.exalate.com/docs/how-to-sync-statuses-in-servicenow)), add the “closed” status to the mapping. You can also directly set the status to “closed” in the script:

```auto
entity.setStatus("Closed")

```

1. **Optional Unexalation** : If you need to unexalate the issue once it’s closed, you can use the following script:

```auto
if(replica.status == "Closed") {
  entity.setStatus("Closed")
  syncHelper.unExalateAfterProcessing()
  return new scala.Tuple2(issueKey, scala.collection.JavaConverters.asScalaBuffer(traces).toSeq())
}

```

This should synchronize the closure of the User Story, RITM, and the associated Task.

---

<div class="post-metadata">

**Author:** ![Juan\_Manuel\_Alarcon](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/juan_manuel_alarcon/32/442_2.png) [@Juan\_Manuel\_Alarcon](https://community.exalate.com/u/Juan_Manuel_Alarcon)\
**Post date:** [January 21, 2025, 7:18pm UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140/3 "2025-01-21T19:18:20Z")

</div>

Hi Javier,

Thank you for the suggestion but thit did not work for me, it only close the RITM but not the task associated to it, I think that is maybe I am no fetching it, but can’t be sure, if you can help me giving me other way to do this it would be wonderfull

---

<div class="post-metadata">

**Author:** ![Dhiren](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/dhiren/32/356_2.png) [@Dhiren](https://community.exalate.com/u/Dhiren)\
**Post date:** [January 29, 2025, 6:04am UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140/4 "2025-01-29T06:04:44Z")

</div>

Hi,

Please find my inputs below

Within the **ServiceNow Incoming Script** , follow these steps to determine if the process is feasible:

1. **Verify Jira Issue Status**

- Check if the Jira issue status is set to **“Closed”**.

1. **Retrieve the Linked Task in ServiceNow**

- Use the **ServiceNow REST API** to perform a **GET** request.
- Identify the associated task by retrieving the **task number/sys\_id** linked to the request item.

1. **Update Task Status**

- Utilize **GroovyHttpClient** to execute a **POST** request that updates the task’s status to **“Closed”**.

1. **Close the Request Item via Exalate**

- Set the status of the request item using Exalate with the following command:

```auto
entity.state = "Closed"

```

While I am not entirely certain, this approach appears feasible based on the available integration methods. Let me know if further clarification or validation is needed.

---

<div class="post-metadata">

**Author:** ![Juan\_Manuel\_Alarcon](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/juan_manuel_alarcon/32/442_2.png) [@Juan\_Manuel\_Alarcon](https://community.exalate.com/u/Juan_Manuel_Alarcon)\
**Post date:** [February 18, 2025, 8:30pm UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140/5 "2025-02-18T20:30:43Z")

</div>

Hi

We have found a solution for this, you should use the following code

def sys\_idV = entity.sys\_id  
httpClient.patch(“/api/now/table/sc\_task/${sys\_idV}”, “”“{  
“state”: “3”,  
“close\_notes”: “Task completed successfully.”  
}”“”)  
}

If it doesn’t work try putting it all toghether on one line and there it will work

---

<div class="post-metadata">

**Author:** ![Javier](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/javier/32/338_2.png) [@Javier](https://community.exalate.com/u/Javier)\
**Post date:** [February 24, 2025, 6:20am UTC](https://community.exalate.com/t/syncing-closure-of-jira-user-story-servicenow-ritm-and-task/6140/6 "2025-02-24T06:20:53Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
