> For the complete documentation index, see [llms.txt](https://docs.aisera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisera.com/aisera-platform/ticket-operations/ticket-concierge-tc-with-event-studio/setting-up-servicenow-to-work-with-ticket-concierge.md).

# Setting up ServiceNow to Work with Ticket Concierge

This topic discusses the ServiceNow setup if you plan to use ServiceNow with Aisera's Ticket Concierge

## Prerequisite:&#x20;

Ask your Aisera team to provide you with an .XML file that contains the Update Set (data you want to upload) to ServiceNow.

## ServiceNow Setup:

1. Log into your ServiceNow system.
2. Navigate to **System Update Sets → Retrieve Update Sets** and upload the .xml file.

<figure><img src="/files/cjDEOCMlPuxfxvb1bMHT" alt=""><figcaption><p>ServiceNow Upload of Retrieved Update Set</p></figcaption></figure>

3. Click Upload.
4. After the file is uploaded, open the **Update Set**.
5. Click **Preview Update Set**, followed by **Commit Update Set**.
6. After committing the update set, verify that the following elements exist:

<figure><img src="/files/zl5xzaRQXHG7pLTylPgA" alt=""><figcaption><p>Verify Elements</p></figcaption></figure>

7. Navigate to the ServiceNow **System Properties** page and perform the following steps.
   1. Search for name **aisera**
   2. This should bring up two results: an app token and a url

<figure><img src="/files/SIQ6iYaYxi2D58SofBnY" alt=""><figcaption><p>ServiceNow System Properties</p></figcaption></figure>

&#x20;     c. Click on the **app token**.

&#x20;     d. Insert the value of the **app token** given to you by your Aisera Team.

&#x20;     e. Click **Update**.

<div align="left"><figure><img src="/files/Fctq5F5YQadPeGLAYbti" alt="" width="563"><figcaption><p>Setting ServiceNow App Token</p></figcaption></figure></div>

&#x20;     f. Navigate back to the prior page and click on the instance url.

&#x20;    g. Insert the value of the **app url** given to you by your Aisera Team.

&#x20;    h. Click **Update**.

8. To verify, this setup, create an incident manually.Then check the system logs by choosing the **All** tab and then typing `system logs`.

<div align="left"><figure><img src="/files/n1sOaFoNhY0Es9VPBPrg" alt="" width="319"><figcaption><p>View All System Logs</p></figcaption></figure></div>

8. Then look for the phrase, **Ticket Concierge Payload**.

<figure><img src="/files/1dAZ6zva37ctRrBtgRPw" alt=""><figcaption><p>Find the Ticket Concierge Payload in the System Logs</p></figcaption></figure>

8. Observe the webhook response above it for numbers like 201,500.

## Creating Business Rules

In your ServiceNow environment, on your uploaded **Update Set**, (Example: `TC event trigger_04/02/25`) click on the associated business rule (**Event Studio TC Business Rule**).

<figure><img src="/files/3mhfP65tbyFSAAr5w14b" alt=""><figcaption><p>Customer Updates Lists in ServiceNow</p></figcaption></figure>

This will take you to a sys script page like the one shown below (depends on your ServiceNow version/setup).

<figure><img src="/files/FUNx6rb9XQ2tDwChUTKz" alt=""><figcaption><p>ServiceNow Script Editor</p></figcaption></figure>

Click **Show Related Record** on the bottom right side of the page.

<div align="left"><figure><img src="/files/dj4d1EhjtCf6i0HRHPgz" alt="" width="319"><figcaption><p>Show Related Record</p></figcaption></figure></div>

Modify the logic that controls when the rule script will run. Specifically, you want it to ensure that your rule is set to run after both **Insert** AND **Update** are checked.&#x20;

Add two filter conditions:

1. Set **Assignment Group** to `Tech Aisera` (not the same as the screenshot, this is a test instance).
2. Set **State** to `New` (Identical to screenshot below).

<figure><img src="/files/NBOwtNvma3ccLQq35xky" alt="" width="563"><figcaption><p>ServiceNow When to Run Tab for Business Rules</p></figcaption></figure>

## Scheduling the Job

To schedule a script execution job:

1. In your ServiceNow instance, navigate to: **System Definition → Scheduled Jobs → Scheduled Script Executions.**
2. Click **New** to create a new **Scheduled Script Execution**.
3. Fill Out the Scheduled Script Execution Form:

   • **Name:** Reassign Stale App Engine Admin Tickets

   • **Active:** ✅

   • **Run:** Periodically

   • **Repeat Interval:** Every 5 minutes (or what suits your load)

   • **Script:** (see below)

Replace all **group** names **(**&#x73;uch as **old group** and **new group)** in the following example with your own variables.&#x20;

```
(function() {
 var now = new GlideDateTime();


 var gr = new GlideRecord('incident');
 gr.addQuery('assignment_group.name', 'old group'); 
 gr.addQuery('state', '2'); // "In Progress"
 gr.addQuery('sys_created_on', '<=', gs.minutesAgo(15));
 gr.query();

 while (gr.next()) {
   var originalSysId = gr.getValue('sys_id');
   var number = gr.getValue('number');

   var dbGroup = new GlideRecord('sys_user_group');
   dbGroup.addQuery('name', 'new group'); replace this with your field and label

   dbGroup.query();

   if (dbGroup.next()) {
     gr.assignment_group = dbGroup.sys_id;
     gr.work_notes = 'Ticket re-routed from old group to new group due to inactivity after 15 minutes.';
     gr.update();

     gs.log('Moved incident ' + number + ' (sys_id: ' + originalSysId + ') to "new group" group.');
   } else {
     gs.logError('Could not find "Database" group. Incident ' + number + ' not updated.');
   }
 }
})();

```

You may have to change the field on the Assignment Group Name and you will definitely have to change the name of the old and new assignment group.&#x20;

The end result should look like the screenshot below:

<figure><img src="/files/XAML17RaFzLQof9t8B3C" alt=""><figcaption><p>Business Rule Script</p></figcaption></figure>

After you set up this business rule, test it by creating an INC ticket in the correct assignment group, with a status of `In  Progress` . Then leave the ticket and check back 20 minutes later.&#x20;

Observe how long it takes from the time the ticket gets created to the time the scheduled job updates the assignment group.&#x20;

In the following screenshot, the first activity is at the bottom and the assignment group update happened roughly 18 minutes later. &#x20;

<figure><img src="/files/yPkILUsAfhUD7drSld5U" alt="" width="563"><figcaption><p>Activity Window</p></figcaption></figure>

If the assignment group never gets updated, check the system logs to see if an error occurred.&#x20;

\ <br>

<br>
