# Sync multiple tickets type

**URL:** <https://community.exalate.com/t/sync-multiple-tickets-type/5291>\
**Category:** General Questions\
**Tags:** servicenow, migrated\_question\
**Created:** [November 4, 2024, 7:55am UTC](https://community.exalate.com/t/sync-multiple-tickets-type/5291 "2024-11-04T07:55:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)\
**Post date:** [November 4, 2024, 7:55am UTC](https://community.exalate.com/t/sync-multiple-tickets-type/5291/1 "2024-11-04T07:55:58Z")

</div>

_Originally asked by Leandre Mundere on 14 September 2022 [(original question)](https://oldcommunity.exalate.com/questions/58494374)_

* * *

Hi,

I want to sync incident and also request, but this is not working as it is creating always incident, I tried to do this in the outgoing sync:

```auto
if(entity.tableName == "incident") {

    replica.key = entity.key
    replica.summary = entity.short_description
    replica.description = entity.description
    replica.attachments = entity.attachments
    replica.comments = entity.comments
    replica.state = entity.state
    

if(entity.tableName =="sc_req_item"){
    replica.key = entity.key
    replica.comments = entity.comments

}

```

and then my incoming sync to be able to switch, i have this:

```auto
if(firstSync){
if(replica.tableName == "incident"){
    entity.tableName = "incident"
}
if(replica.tableName == "sc_req_item"){
entity.tableName = "sc_req_item"
}
}

```

But this is not working, anybody knows what I have wrong?

Thanks

* * *

#### Comments:

> **Ariel Aguilar commented on 16 September 2022**
>
> > Hi there,
> 
> Is this a local connection? Or what other instance besides ServiceNow is synchronized? For example, if the Jira remote type is Bug, you could try to do something in ServiceNow incoming script like:
> 
> ```auto
> if(firstSync){
> //Decide on the first sync, which entity you want to create based on the remote issue type
> if(replica.typeName == "Bug"){
> entity.tableName = "sc_req_item"
> }else{
> entity.tableName = "incident" 
> }
> }
> if(entity.tableName == "sc_req_item") {
> entity.short_description = replica.summary
> entity.description = replica.description
> entity.comments += replica.addedComments
> entity.attachments += replica.addedAttachments
> }
> if(entity.tableName == "incident") {
> entity.short_description = replica.summary
> entity.description = replica.description
> entity.comments += replica.addedComments
> entity.attachments += replica.addedAttachments
> }
> 
> ```
> 
> Kind regards,
> 
> Ariel

---

<div class="post-metadata">

**Author:** ![Majid](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/majid/32/343_2.png) [@Majid](https://community.exalate.com/u/Majid)\
**Post date:** [December 4, 2024, 9:27am UTC](https://community.exalate.com/t/sync-multiple-tickets-type/5291/2 "2024-12-04T09:27:10Z")

</div>


