monday to ServiceNow Integration User Guide
KVenkatachalam
TDuraisamy
Many companies use Service Now and monday.com for their different teams for different purposes. Many times engineering and product team uses http://Monday.com , while customer support and operations team are on Service Now. This plugin is designed to bring these two disparate systems together. This plugin allows for seamless bi-directional sync between ServiceNow incidents with monday.com.
In monday application client data stored in a row column fashion called boards these are the features which provide enhance capability to both the applications.
No need of manual creations of items in service now
If a user creates an items in monday board then the plugin will create the corresponding item fields in service now
It syncs all values from monday to ServiceNow item including boards, columns and comments based on the mapping of the fields.
If user updates items in monday then the plugin updates the same values in the service now.
It links users in monday & service now.
Users can easily track changes and sync between two different systems using this seamless integration.
Integration Settings
Step 1: Go to monday Marketplace/Integration Center and search for “ServiceNow Connector”.
Step 2: Click on listed application.
Recipes Descriptions:
When an update is created choose IntegrationId then send data to ServiceNow. this recipe will push board comments into ServiceNow comments.
When any column changes choose IntegrationId then send data to ServiceNow with these mappings. this recipe will push board columns data into ServiceNow when any columns updated by user.
When item name changes choose IntegrationId then send data to ServiceNow with these mappings. this recipe will push board item column data into ServiceNow when item name updated by user.
When an item is created send data to ServiceNow with these mappings. this recipe will create item/incident into ServiceNow when new item is created by user in board.
When column changes upload the file to ServiceNow where the corresponding record's column matches the IntegrationId. this recipe will push board file column data into ServiceNow when attachment table updated by user and then for When column changes choose only file column.
Note:
If you are adding these recipes in your board then in that board some of below mentioned column should be there and Create the “Status”, “Impact”, “Urgency”, “Description” and “File“ columns if it is not there in monday board.
“Status“, “Urgency“ and “Impact“ status column labels are case sensitive should be given proper below mentioned labels.
The integration will be done by admin. Any user who is eligible to add items in the board will have the items synchronized to the configured service now instance.
Don’t Change the “**Integration Id“ and “**Incident Number“ text column title and Don’t delete the “**Integration Id“ and “**Incident Number“ columns.
Short Description => Name(Item Name Column)
Description => Description(Long Text Column)
Impact => Impact(Status Column)
State => Status(Status Column)
Urgency => Urgency(Status Column)
**Integration Id => IntegrationId(Text Column)
**Incident Number=> Incident Number(Text Column)
Status with labels
New
In Progress
On Hold
Resolved
Closed
Canceled
Impact with labels
High
Medium
Low
Urgency with labels
High
Medium
Low
Before going to the “Add to board“ Log in to your ServiceNow account and go to the “Application Registry”->create one app so that app Redirect URL should be “https://snowprod.empyra.com/getOauthToken“ and serviceNow incident create one text field name as “monday Intg Id“.
Step 3: Click on “Add to board” for adding desired recipes in your board you will encounter this screen.
Step 4: In dropdown previously, connected account will be listed. you can use this previous connected account or else click on “Integrate with your account“ for integrate your new ServiceNow account.
Case 1. For New Account click on “Integrate with your account“ you will be redirected to Configure form
Fields Descriptions:
ServiceNow Instance Name: ServiceNow instance name.
Example: dev00000
ServiceNow App Name: ServiceNow Account App Name
Client Id: ServiceNow Account app client id.
Client Secret: ServiceNow Account app client Secret.
monday Integration User ID: monday Service Account User ID (Don’t add your user ID add monday.com service user ID).
Enable Create: To enable the create items in ServiceNow enable checkbox.
Enable Update: To push the items update into ServiceNow enable checkbox.
Enable Comment: To push the comments into ServiceNow enable checkbox.
Click on “Allow“ button it will authenticate and redirect into “API URL Information Page“.
Select Snow Entity: By default “incident“ will be selected. You can choose ServiceNow entity like incident, change request, demand request according to your preference
ServiceNow REST API URLS [ Once You select Snow Entity these fields value will get be filled]:
GET: this api url used to fetch incident data from ServiceNow
CREATE: this api url used to create incident into incident table in ServiceNow.
UPDATE: this api url used to update incident table data in ServiceNow.
GET FIELDS: this api url used to fetch all fields of incident table from ServiceNow.
ADD ATTACHMENTS: this api url used to add attachments in incident table of ServiceNow.
In Above Screens ServiceNow fields which will used for mapping(Short description, Description, State, Impact, Urgency) with monday board column in recipes sentence Now Click On ' SUBMIT'
Currently we are supporting this five fields for integration. We will add additional fields in future.
Your data will be got stored & you will be redirected to monday recipes sentence.
If “IntegrationId“ is there then Click on “IntegrationId“ & select “**Integration Id” which is monday column. Similarly click on 'mappings' & map ServiceNow Column with monday Columns.
After Mapping Click on “Add To Board “ Recipes will get add into your board.
Case 2. For Existing Account Select Account from drop down menu & click 'Select Account' like below picture
In Above Screens you can choose the “Select Account“ button and it will be redirected into the particular recipe, then map the fields and click on “Done“.
Case 3: If you want to delete the account then you can enable the “Enable Delete“ checkbox and then click on the “Delete Account“ button it will delete the account.
Case 1: Creating an item on monday should create an incident in ServiceNow.
Step 1: Make sure while creating an item on monday below, a recipe should be added.
Once an incident is created in serviceNow take the sysId and incident number and populate them into the monday board “**Incident Number“ and “**Integration Id“ columns.
Case 2: Updating an item on monday should update an incident in ServiceNow.
Step 1: Make sure while updating an item on monday below, a recipe should be added.
Case 3: Creating an update on monday should be a comment in ServiceNow.
Step 1: Make sure, while creating an update on monday below, a recipe is added.
Case 4: Updating an item name on monday should update an incident name in ServiceNow.
Step 1: Make sure, while updating an item name on monday below, a recipe should be added.
Case 5: Upload the attachment on monday should be uploaded in ServiceNow.
Step 1: Make sure, while uploading an attachment on monday below, a recipe is added.
Rest Message Configuration:
Create and Update an Item Rest Message Configuration:
Login your serviceNow Account and search bar type a “Rest Message“ and click “New“ button.
Step 2: Configure the rest messages below mentioned image.
Once you filled the Name, Description, Endpoint click on the update button then it will shows the “HTTP Method“.
“fetchBoardData” endpoint should be : “https://api.monday.com/v2“.
“AttachmentTomonday” endpoint should be : “https://snowprod.empyra.com/msnow/recieve-file-snow“.
Rest Message Configuration For Attachment.
Create an one Rest Message similar like a above one mentioned in the image.
Once you filled the Name, Description, Endpoint click on the update button then it will shows the “HTTP Method“.
“ServiceNowmondayAttachement” endpoint should be : “https://snowprod.empyra.com/msnow/recieve-file-snow“
Business Rules Configuration For Create, Update and Attachment
Login to your ServiceNow account and search bar, type “business rules,“ and click the “New“ button.
Case 1: Create an incident on serviceNow should create an item on monday:
Step 1: Configure the business rules below mention an image.
Step 2: Click on “Advanced“ tab and add the script.
(function executeRule(current, previous /*null when async*/ ) {
try {
gs.log("Hello data");
// Check if the business rule is executed by a particular user
var targetUserId = '89899'; // Replace with the ID of the user you want to check
// Get the ID of the current user
var currentUserId = gs.getUser().getID();
gs.log("Current Users "+current.currentUserId);
// Check if the current user is the target user
if (currentUserId == targetUserId) {
// If the current user is the target user, just return without executing further logic
return;
}
var request = new sn_ws.RESTMessageV2('MondayGraphQLAPI', 'fetchBoardData');
var sourceData = "MondayServiceNowIntegration";
var incident_number = current.number;
var incident_sysId = current.sys_id;
var incident_short_description = current.short_description;
var incident_state = current.state;
var incident_urgency = current.urgency;
var incident_impact = current.impact;
var snow_worknotes = current.work_notes.getJournalEntry(1);
var incident_monday_urgency = "";
var incident_monday_impact = "";
var incident_monday_state ="";
var boardId="your_board_id";
if (incident_state == 1) {
incident_monday_state = "New";
}
if (incident_state == 2) {
incident_monday_state = "In Progress";
}
if (incident_state == 3) {
incident_monday_state = "On Hold";
}
if (incident_state == 6) {
incident_monday_state = "Resolved";
}
if (incident_state == 7) {
incident_monday_state = "Closed";
}
if (incident_state == 8) {
incident_monday_state = "Canceled";
}
if (incident_urgency == 1) {
incident_monday_urgency = "High";
}
if (incident_urgency == 2) {
incident_monday_urgency = "Medium";
}
if (incident_urgency == 3) {
incident_monday_urgency = "Low";
}
if (incident_impact == 1) {
incident_monday_impact = "High";
}
if (incident_impact == 2) {
incident_monday_impact = "Medium";
}
if (incident_impact == 3) {
incident_monday_impact = "Low";
}
gs.log("The incident_short_description" + incident_short_description, sourceData);
gs.log("The State is :" + incident_state, sourceData);
gs.log("The Urgency :" + incident_urgency, sourceData);
var incident_description = current.description;
request.setEndpoint(request.getEndpoint());
gs.log("##The End Point :" + request.getEndpoint(), sourceData);
var query_mutation = 'mutation ($item_name : String!, $columnValues: JSON!) { create_item ( board_id:'+boardId+', item_name: $item_name, column_values: $columnValues ) { id name }}';
var data_input = {
"item_name": '' + incident_short_description + '',
"columnValues": "{\"long_text__1\":\"" + incident_description + "\", \"__incident_number5__1\": \"" + incident_number + "\", \"__integration_id4__1\": \"" + incident_sysId + "\",\"status\":{\"label\":\"" + incident_monday_state + "\"},\"status_1__1\":{\"label\":\"" + incident_monday_impact + "\"},\"status_11__1\":{\"label\":\"" + incident_monday_urgency + "\"}}"
};
var reqbody = {
'query': query_mutation,
'variables': data_input
};
gs.log("The request body :" + JSON.stringify(reqbody), sourceData);
request.setRequestBody(JSON.stringify(reqbody));
var response = request.execute();
var httpStatus = response.getStatusCode();
var httpResponseBody = response.getBody();
var responseObject = JSON.parse(httpResponseBody);
gs.log("The responseObject #:"+responseObject, sourceData);
gs.log("The Status Code #:" + httpStatus, sourceData);
gs.log("The Response Body #:" + httpResponseBody, sourceData);
current.u_monday_intg_id = responseObject.data.create_item.id;
gs.log("The monnday key #:"+current.u_monday_intg_id, sourceData);
current.update();
gs.log("####END OF INCIDENT UPDATE FROM CREATE####", sourceData);
var now_GR =new GlideRecord('sys_attachment');
now_GR.addQuery('table_sys_id',current.sys_id);
now_GR.query();
while(now_GR.next()){
var mondayAccountId="your_account_id";
var mondayAccessToken="your_monday_service_account_user_token";
var mondayFileColumn="monday_file_columnId";
var mondayIntegrationIdColumnId="monday_integrationId_columnID";
var body = {
"boardId":"",
"sys_id":"",
"columnId":"",
"itemId":"",
"mondayToken":"",
"accountId":"",
"columnIdOfIntegrationIdInMonday":"",
};
body.boardId=boardId;
body.sys_id=now_GR.getValue('sys_id');
body.columnId=mondayFileColumn;
body.itemId = current.getValue('sys_id');
body.mondayToken=mondayAccessToken;
body.accountId=mondayAccountId;
body.columnIdOfIntegrationIdInMonday=mondayIntegrationIdColumnId;
try{
var payLoad=JSON.stringify(body);
var requestOfAttachment = new sn_ws.RESTMessageV2('MondayGraphQLAPI','AttachmentToMonday');
requestOfAttachment.setRequestBody(payLoad);
var responseOfAttachment = requestOfAttachment.execute();
var httpStatusOfAttachment = responseOfAttachment.getStatusCode();
var httpResponseBodyOfAttachment = httpStatusOfAttachment.getBody();
}catch(err){
gs.log(JSON.stringify(err));
}
}
// Add your code here
} catch (ex) {
var message = ex.message;
gs.log("The error message " + message, sourceData);
}
})(current, previous);
Above code you can replace the board Id, account Id, mondayAccessToken, mondayFileColumnId, mondayIntegrationColumnId, target user Id, monday column Ids and then click on the “Update“ button.
Step 3: Go to create an incident in serviceNow.
Case 2: Update an incident on serviceNow should update an item on monday:
For update an item in monday create one business rule similar like create an item business rule.
Step 1: Configure the business rules below mention in image.
Step 2: Click on “Advanced“ tab and add the script.
(function executeRule(current, previous /*null when async*/ ) {
// Check if the business rule is executed by a particular user
var targetUserId = 'your_targer_user_id'; // Replace with the ID of the user you want to check
// Get the ID of the current user
var currentUserId = gs.getUser().getID();
// Check if the current user is the target user
if (currentUserId == targetUserId) {
// If the current user is the target user, just return without executing further logic
return;
}
try {
// Add your code here
var request = new sn_ws.RESTMessageV2('mondayGraphQLAPI', 'fetchBoardData');
var sourceData = "mondayServiceNowIntegrationUpdateQuery";
var incident_number = current.number;
gs.log("IncidentNumber:"+incident_number);
var incident_sysId = current.sys_id;
var incident_short_description = current.short_description;
gs.log("The incident_short_description from update" + incident_short_description, sourceData);
var incident_description = current.description;
var monday_item_id = current.u_monday_intg_id;
request.setEndpoint(request.getEndpoint());
gs.log("##The End Point :" + request.getEndpoint(), sourceData);
gs.log("##I am coming :");
var incident_state = current.state;
var incident_urgency = current.urgency;
var incident_impact = current.impact;
var incident_monday_urgency = "";
var incident_monday_impact = "";
var incident_monday_state ="";
gs.log("Incident statessssss "+incident_state);
if (incident_state == 1) {
incident_monday_state = "New";
}
if (incident_state == 2) {
incident_monday_state = "In Progress";
}
if (incident_state == 3) {
incident_monday_state = "On Hold";
}
if (incident_state == 6) {
incident_monday_state = "Resolved";
}
if (incident_state == 7) {
incident_monday_state = "Closed";
}
if (incident_state == 8) {
incident_monday_state = "Canceled";
}
//For Urgency
if (incident_urgency == 1) {
incident_monday_urgency = "High";
}
if (incident_urgency == 2) {
incident_monday_urgency = "Medium";
}
if (incident_urgency == 3) {
incident_monday_urgency = "Low";
}
//For Imapact
if (incident_impact == 1) {
incident_monday_impact = "High";
}
if (incident_impact == 2) {
incident_monday_impact = "Medium";
}
if (incident_impact == 3) {
incident_monday_impact = "Low";
}
gs.log("Hello Itis "+monday_item_id);
var monday_id=JSON.parse(monday_item_id);
gs.log("Moondayitem______:"+incident_number);
var query_update_mutation = 'mutation ($columnValues: JSON!) { change_multiple_column_values(item_id:' + monday_item_id + ', board_id:your_monday_board_id, column_values: $columnValues) { id }}';
var data_update = {
"columnValues": "{\"name\":\"" + incident_short_description + "\" ,\"long_text\":\"" + incident_description + "\" ,\"text9\": \"" + incident_number + "\", \"text5\": \"" + incident_sysId + "\",\"status9\":{\"label\":\"" + incident_monday_state + "\"},\"priority\":{\"label\":\"" + incident_monday_impact + "\"},\"status_14\":{\"label\":\"" + incident_monday_urgency + "\"}}"
};
var reqbody = {
'query': query_update_mutation,
'variables': data_update
};
gs.log("query checking :" + query_update_mutation);
gs.log("The request body :" + JSON.stringify(reqbody), sourceData);
request.setRequestBody(JSON.stringify(reqbody));
var response = request.execute();
var httpStatus = response.getStatusCode();
gs.log("The Status Code " + httpStatus, sourceData);
gs.log("The response body from update query:" + response.getBody(), sourceData);
gs.log("####END OF INCIDENT UPDATE QUERY####", sourceData);
} catch (ex) {
var message = ex.message;
gs.log("The error message " + message, sourceData);
}
})(current, previous);
Above code you can replace the board Id, target user Id and monday column Ids and then click on the “Update“ button.
Step 3: Go to update an incident like Description, State.
Case 3: Upload an attachment on serviceNow should upload the attachment in monday.
For Upload an attachment in monday create one business rule similar like create an item business rule.
Step 1: Configure the business rules below mention in image.
Step 2: Click on “Advanced“ tab and add the script.
(function executeRule(current, previous /*null when async*/ ) {
//When inetgration user is doing this then it should not go to attachment process
// Check if the business rule is executed by a particular user
var targetUserId = '7676767'; // Replace with the ID of the user you want to check
// Get the ID of the current user
var currentUserId = gs.getUser().getID();
// Check if the current user is the target user
if (currentUserId == targetUserId) {
gs.log('Intg Found');
// // If the current user is the target user, just return without executing further logic
return;
}
var mondayBoardId="your_board_id";
var mondayAccountId="your_account_id";
var mondayAccessToken="your_monday_service_user_id_token";
var mondayFileColumn="monday_file_column_id";
var mondayIntegrationIdColumnId="monday_integrationId_text_columnID";
var body = {
"boardId":"",
"sys_id":"",
"columnId":"",
"itemId":"",
"mondayToken":"",
"accountId":"",
"columnIdOfIntegrationIdInMonday":"",
};
body.boardId=mondayBoardId;
body.sys_id=current.getValue('sys_id');
body.columnId=mondayFileColumn;
body.itemId = current.getValue('table_sys_id');
body.mondayToken=mondayAccessToken;
body.accountId=mondayAccountId;
body.columnIdOfIntegrationIdInMonday=mondayIntegrationIdColumnId;
try{
var payLoad=JSON.stringify(body);
gs.log(payLoad);
var request = new sn_ws.RESTMessageV2('MondayAttachmentRestMessage','ServiceNowMondayAttachement');
request.setRequestBody(payLoad);
var response = request.execute();
var httpStatus = response.getStatusCode();
var httpResponseBody = response.getBody();
}catch(err){
gs.log(JSON.stringify(err));
}
})(current, previous);
Above code, you can replace the mondayBoardId, target user Id, mondayAccountId, mondayAccessToken, mondayFileColumn - get it from monday board file column Id, mondayIntegrationIdColumnId - get it from monday board “**Integration Id“ column Id and then click on the “Update“ button.
Case 4: Add an work notes on serviceNow should add update on monday.
For add an work notes in monday create one business rule similar like create an item business rule.
Step 1: Configure the business rules below mention in image.
Step 2: Click on “Advanced“ tab and add the script.
(function executeRule(current, previous /*null when async*/ ) {
// Check if the business rule is executed by a particular user
var targetUserId = 'your_target_user_id'; // Replace with the ID of the user you want to check
// Get the ID of the current user
var currentUserId = gs.getUser().getID();
// Check if the current user is the target user
if (currentUserId == targetUserId) {
// If the current user is the target user, just return without executing further logic
return;
}
try {
// Add your code here
var request = new sn_ws.RESTMessageV2('mondayGraphQLAPI', 'fetchBoardData');
var sourceData = "mondayServiceNowIntegrationUpdateComments";
var incident_number = current.number;
var incident_sysId = current.sys_id;
var incident_short_description = current.short_description;
var snow_worknotes = current.work_notes.getJournalEntry(1);
var incident_description = current.description;
var monday_item_id = current.u_monday_intg_id;
request.setEndpoint(request.getEndpoint());
var query_update_mutation = 'mutation { create_update (item_id: ' + monday_item_id +
' , body: "' + snow_worknotes + '") {id}} ';
var reqbody = {
'query': query_update_mutation,
};
request.setRequestBody(JSON.stringify(reqbody));
var response = request.execute();
var httpStatus = response.getStatusCode();
gs.log("The Status Code " + httpStatus, sourceData);
gs.log("The response body:" + response.getBody(), sourceData);
} catch (ex) {
var message = ex.message;
gs.log("The error message " + message, sourceData);
}
})(current, previous);
Step 3: Go to add a work notes on incident.
Above code you can replace the target user Id and then click on the “Update“ button.
Enjoy this seamless integration between monday to ServiceNow
7. Release Note:
Version 1.0