Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Business Rules configuration is required for automating processes and enforcing business logic within the platform. It enables proper synchronization of data between ServiceNow and Jira.

Follow the below steps to create Business Rules in your ServiceNow platform:

Step 1: Login to ServiceNow account.

Step 2: Click on All and search Business Rules. Select Business Rules under Administration option.

7.PNG

Step 3: Click on New.

8.PNG

Step 4: Create business rules to push data from ServiceNow to JIRA.

  1. Add Name.

Example: cloud_create_item

  1. Click on Table dropdown and select Incident [Incident].

  2. Click on Advanced checkbox.

Select When to run tab and fill the below details in the fields.

  1. Click on When dropdown and select after option.

  2. Add value 100 to Order field.

  3. Select Insert checkbox.
    Add below Filter Conditions

  4. Click on choose field dropdown and select Jira Issue Key.

  5. Click on starts with dropdown and select is empty.

  6. Click on Update.

image-20230425-075649 (1).png
  1. Select Advanced tab and add the below given script.

10.PNG

Copy the script below and paste it in the Advanced tab.

try { 
	gs.log("####START OF INCIDENT UPDATE####");
	var request = new sn_ws.RESTMessageV2('JIRA Update Issue', 'PUT');	
	request.setEndpoint(request.getEndpoint() + current.u_jira_issue_key);	
	gs.log("##The End Point :"+request.getEndpoint(),'UpdateJiraForDemo');
	var currentIssueKey = 	current.u_jira_issue_key;
	var currentDescription = current.description.replace(/\n|\r/g, " ");		
	var currentDescriptionSplit = currentDescription.split("-------------------------------------------------------------");
	gs.log("The End Point"+request.getEndpoint(),'UpdateJiraForDemo');		
	var currentShortDesc = current.short_description.getDisplayValue();
	var requestBody = {
		fields: {
			summary: currentShortDesc,
			description: currentDescriptionSplit[1]		
	};	
		gs.log("The request body :"+JSON.stringify(requestBody),'UpdateJiraForDemo');
		request.setRequestBody(JSON.stringify(requestBody)) ;
		var response = request.execute();
		var httpStatus = response.getStatusCode();
		gs.log("The Status Code "+ httpStatus,'UpdateJiraForDemo');
		gs.log("####END OF INCIDENT UPDATE####",'UpdateJiraForDemo');
}
catch(ex) {
 var message = ex.message;
}
})(current, previous);
  1. Click on Save button to update the script.

11.PNG
  1. Click on Submit.

13.PNG

Note: Reach out to your ServiceNow team to configure the above steps in ServiceNow. If you need our help, you can reach out to us for paid professional services (atlassian@empyra.com).

 

  • No labels