Advanced Scripting
Last updated
Was this helpful?
Last updated
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 https://getint.io/introducing-getint-io-advanced-scripting/
To access the Advanced Scripting tab and understand the available variables for your integration, follow these steps:
From your integration editor, click the More button
Then, click Advanced
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.
Is run every time just before integration runs:
Is run before CREATE or UPDATE requests are sent with item data:
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
If state.comment.skipped flag is set up, an equal true comment will be skipped and the request won't be sent.
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:
ServiceNow Side Script
The following script should be used on the SNOW side to map the Jira user correctly:
By using these scripts, you can effectively map ServiceNow User IDs to Jira usernames, ensuring seamless integration and synchronization between your systems.
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.
If you encounter any issues or need further assistance, please contact our support team here. Our fantastic team at Getint is always ready to assist you!