Getint: Where every ticket finds it's place.
Support portalCase studiesSchedule a demo
  • Welcome to the Getint Documentation Hub
  • Getting started with Getint
    • About Getint / Concepts
      • How Getint works (how it syncs the data)
      • Onboarding
      • What is a Connection?
      • What Are Runs
      • One-directional / Bi-directional integration
      • Migration vs Integration
      • How Integrations Are Executed By Getint
    • Starting the Free Trial and Accessing the Getint App
      • Selecting the Correct app per license
      • How do I extend the trial of getint.io?
      • Jira Access and User Management
    • Deployment options
      • Getint for Jira Data Center / Jira Server
        • Getint Jira Server / Jira Data Center App (native)
        • Getint for Jira Data Center / Jira Server - Architecture
      • Getint for Jira Cloud
      • Getint On-Premise
        • Architecture
        • Installation
          • How to Install Getint On-Premise in Windows Server
          • On-Premise/Standalone Guide
        • Updating On-Premise
        • Cluster High Availability
    • Prepare for the integration
      • Understanding the difference between platforms you integrate
      • One-to-One, One-to-Many, and Many-to-Many integration
      • Simplifying Workflow Sync with Getint: Jira
    • Connectors
      • Jira
      • Asana
      • Azure DevOps
      • Freshdesk
      • GitLab
      • HubSpot
      • Monday.com
      • Notion
      • Salesforce
      • ServiceNow
      • Zendesk
  • Guides
    • Quickstart
      • Integration
      • Connection
    • Integration Guides
      • How to Map Fields
      • How to create a custom field in all supported software
      • Git Repository integration
        • Git Connector - Azure DevOps
        • Git Connector - GitHub
        • Git Connector - GitLab
      • Azure DevOps Asana integration
      • Jira Airtable integration
      • Jira Asana integration
        • Jira - Asana: Subtasks synchronization
      • Jira Azure DevOps integration
        • How to Setup a Connection with Azure DevOps On-Premise
        • Jira - Azure DevOps: Epics and Subtasks Synchronization
        • Syncing Dependencies between Jira and Azure DevOps using Getint
      • Jira ClickUp integration
      • Jira Freshdesk integration
      • Jira Freshservice integration
      • Jira GitHub integration
      • Jira GitLab integration
        • Attachments Sync in GitLab Integration
      • Jira HubSpot integration
      • Jira Jira integration
        • Jira Jira licensing
        • Time Tracking in Getint – One-Way Synchronization
      • Jira Monday.com integration
        • Synchronizing Attachments in a Monday.com Integration
        • How to Insert Monday.com Items into Specific Groups Using Getint
      • Jira Notion integration
      • Jira Salesforce integration
        • Salesforce OAuth Authentication
      • Jira ServiceNow integration
        • Creating a ServiceNow User for Getint Integration
        • ServiceNow OAuth authentication
        • Creating a Custom Field in ServiceNow
        • How to Restrict "Incident" Data to Specific 3rd Party Companies
        • How to Restrict Access to Specific Tables for Integration
        • REST API requests list
      • Jira Trello integration
      • Jira Wrike integration
      • Jira Zendesk integration
        • How to Manually Provide Zendesk Organization ID and Name
    • Migration Guides
      • Migrating Data with Getint
      • Migration support, and onboarding
      • Jira to Jira migration
      • Asana to Jira migration
      • Azure DevOps to Jira migration
      • GitLab to Jira migration
      • Jira to Monday.com Migration
      • Jira Zendesk migration
  • Using Getint
    • Core Features of Getint
    • Workflows
      • Type Mapping
      • Integrations List
      • Configuring Your Data Sync: Bidirectional and Unidirectional Options
      • Syncing Attachments
      • Hierarchy
      • Assignees (users) mapping
      • Mapping Labels
      • Filtering Items for Integration in Getint
        • Troubleshooting Sync Issues: Unmet Filter Conditions
        • How to Filter Comments
        • Filtering by Assignment Group and Status
      • Shared Mappings in Getint – Centralized Mapping for Efficient Integrations
      • How to Use JQL Filters for Jira Integrations
      • Integration status
      • Storing counterpart link in the task comment
      • Storing Reference IDs/URLs Across Integrations
    • Connections
      • Troubleshooting Getint Integration Connectivity Issues
      • Permissions Issue: Status Code 500
      • Editing Connections for Existing Integrations
      • Changing the URL or Transitioning Between Instances
      • Debugging Connections in Getint: How to Troubleshoot and Resolve Issues
    • Quick Build
    • Reporting
    • Notifications
    • Request type issue on Jira Service Management how to select and work with it
    • Integrating one project with many: Streamlining synchronization across multiple projects.
      • One to Many Project - El Ride Use Case
    • Transition Fields
    • Resync and Hard Resync
    • Synchronizing Existing Items on Both Sides
    • Handling Syncs for Deleted Items
    • Advanced Scripting
    • Platform Release History
      • Getint Version 1.82
      • Getint Version 1.81
      • Getint Version 1.80
      • Getint Version 1.79
      • Getint Version 1.78
      • Getint Version 1.77
      • Getint Version 1.76
      • Getint Version 1.75
      • Getint Version 1.74
      • Getint Version 1.73
      • Getint Version 1.72
      • Getint Version 1.71
      • Getint Version 1.70
      • Getint Version 1.69
      • Getint Version 1.68
      • Getint Version 1.67
      • Getint Version 1.66
      • Getint Version 1.65
      • Getint Version 1.64
    • Settings
      • Data Storage
      • Sharing Access Permission
      • How to Override Getint Behavior Using Custom Properties
  • Support, legal & others
    • FAQ
      • Technical FAQ
      • Security FAQ
    • Troubleshooting Guide for Getint Users
      • Resolving Error 500 in Jira ServiceNow Integration
      • Locating Your Instance ID for Support
      • Connection Error: Certification Path Failed/PKIX Path Building Failed
      • Error: Field '<field-name>' cannot be set. It is not on the appropriate screen, or unknown
      • Connection timed out error
      • Troubleshooting: Integration Task Retrieval Error
      • Upgrade to newest version from version lower than 1.52
      • Debug Requests Feature
      • Troubleshooting: Resolving Hanging Integration Runs in Getint
      • Troubleshooting License Issues in Getint
    • Security and compliance
    • Support / SLA
    • Privacy & Security
      • Data Residency with Getint
    • Procurement & Legal
      • Enhanced Support for Vendor Onboarding and Security Assessments
      • EULA
      • Privacy policy
  • Billing & Services
    • Transparent and User-Friendly Pricing
    • Consulting and Custom Development
    • Understanding Getint Licensing and Pricing
      • How to pay for the apps
      • Migrations
      • Network License
      • Jira-Jira Licensing Model
      • Partners
      • Seamless Transition Offer: Migrate from Competitors to Getint with Exclusive Benefits
  • Use cases
  • Pricing Comparison: Getint vs. Alternatives
  • Battlecards (getint.io vs competitors)
  • Free migration from ConnectAll, Backbone, Exalate, Unito, Workato, TFS4JIRA and other tools
  • Anything missing? Getint is feedback driven
Powered by GitBook
On this page
  • How to access the Advanced Scripting tab
  • List of events you can define with the scripting feature
  • Example

Was this helpful?

  1. Using Getint

Advanced Scripting

PreviousHandling Syncs for Deleted ItemsNextPlatform Release History

Last updated 6 months ago

Was this helpful?

Advanced mode (scripting) allows you to customize app logic for building data that will be sent to apps via API. When adding a script to the fields in the Advanced Configuration section, ensure that it adheres to JavaScript (JS) syntax. Essentially, this script runs within Getint when specific events are triggered.

Read more about advanced scripting here

How to access the Advanced Scripting tab

To access the Advanced Scripting tab and understand the available variables for your integration, follow these steps:

  1. From your integration editor, click the More button

  1. Then, click Advanced

  1. The Advanced Configuration tab will be displayed, each checkbox enables a code row that can be used to run custom scripts that make the tool send specific requests before specific steps of the synchronization process.

Scripts applied to Before integration runs will trigger every time that an integration is going to run. Here we can provide some logic whenever an integration is syncing, as long as it complies with JavaScript (JS) syntax.

List of events you can define with the scripting feature

Before integration runs

Is run every time just before integration runs:

api.leftApp.fetch(url) - fetch data from endpoint from LEFT side app
api.leftApp.post(url, postData) - post data to LEFT side app
api.rightApp.fetch(url) - fetch data from endpoint from RIGHT side app
api.rightApp.post(url, postData) - post data to RIGHT side app
api.log(string) - write a log line to log file of the run

Before the item request object sent

Is run before CREATE or UPDATE requests are sent with item data:

api.leftApp.fetch(url) - fetch data from endpoint from LEFT side app
api.leftApp.post(url, postData) - post data to LEFT side app
api.rightApp.fetch(url) - fetch data from endpoint from RIGHT side app
api.rightApp.post(url, postData) - post data to RIGHT side app
api.log(string) - write a log line to log file of the run

state.syncAction - Create or Update 
state.reqObj - request object data (containing fields) that was prepared by GetInt
state.triggerObj - data of the trigger/source object

For instance, if ITEM-1 was modified in Jira and will be synced with Azure Work Item #32, state.triggerObj contains data of ITEM-1 and state.reqObj is a constructed data object that will update #32

Before a comment is created

api.leftApp.fetch(url) - fetch data from endpoint from LEFT side app
api.leftApp.post(url, postData) - post data to LEFT side app
api.rightApp.fetch(url) - fetch data from endpoint from RIGHT side app
api.rightApp.post(url, postData) - post data to RIGHT side app
api.log(string) - write a log line to log file of the run

state.comment - comment data that was prepared by GetInt to send

If state.comment.skipped flag is set up, an equal true comment will be skipped and the request won't be sent.

Mapping SNOW User ID to Jira Username

To ensure proper synchronization between SNOW and Jira when the SNOW User ID equals the Jira username, use the following scripts. Make sure the default mapping for both sides is set to Use value from the other side

Jira Side Script

The following script should be used on the Jira side to map the ServiceNow user correctly:


if (state.reqObj.fields && state.reqObj.fields.assignee) {
    var userIdentifier = state.reqObj.fields.assignee.name;
    var response = api.rightApp.fetch('/api/now/v2/table/sys_user?sysparm_query=sys_id=' + userIdentifier + '&sysparm_fields=user_name');
    if (response && response.result && response.result[0]) {
        api.log('found snow user ' + response.result[0].user_name + ' by searching for ' + userIdentifier);
        state.reqObj.fields.assignee.name = response.result[0].user_name;
    }
}

ServiceNow Side Script

The following script should be used on the SNOW side to map the Jira user correctly:

if (state.reqObj.assignee) {
    var userIdentifier = state.reqObj.assignee.name;
    var response = api.rightApp.fetch('/api/now/v2/table/sys_user?sysparm_query=sys_id=' + userIdentifier + '&sysparm_fields=user_name');
    if (response && response.result && response.result[0]) {
        api.log('found snow user ' + response.result[0].sys_id + ' by searching for ' + userIdentifier);
        state.reqObj.assignee.name = response.result[0].user_name;
    }
}

By using these scripts, you can effectively map ServiceNow User IDs to Jira usernames, ensuring seamless integration and synchronization between your systems.

Example

Migrating GitLab issue to Jira. Except for field data we want to copy to Jira information about related merge requests to the given GitLab issue. GitLab offers API where we can that necessary information and obtain Pull Requests data in JSON format. Jira is on the left side in integration and GitLab is on the right side. To achieve what we need we have to put below JavaScript code below under the Before item request object sent (left app) option.

// 1 - fetch merge requests data frmo rightApp (GitLab)
var links = api.rightApp.fetch('/api/v4/projects/' + state.triggerObj.project_id + '/issues/' + state.triggerObj.iid + '/related_merge_requests');
if (links) {
  // 2 - iterate over links and add to the array
  for (var i=0; i<links.length; i++) {
    var link = links[i].web_url;
    linksArray.push('[' + link + '|' + link + ']');
  }
}
// 3 - join links together and insert into a customfield
state.reqObj.fields['customfield_10174'] = mergesArray.join('\n');

If you encounter any issues or need further assistance, please contact our support team . Our fantastic team at Getint is always ready to assist you!

here
https://getint.io/introducing-getint-io-advanced-scripting/
We’re using a Jira Jira integration as an example, but this concept applies to our other supported apps.
Having issues to build your integration? Schedule a free consultation with our Integration Experts now!