# ServiceNow and Jira recipe

This use case guides you through connecting ServiceNow and Jira to create a powerful automation.

# What does this recipe do?

This recipe monitors ServiceNow for new incidents and creates a corresponding issue in Jira if an existing issue doesn't already exist.

# Recipe configuration

Recipes are automated workflows that connect your apps. Each recipe contains a trigger and one or more actions. The following diagram illustrates the trigger and action configuration required for this use case:

flowchart TD subgraph Configuration[" "] direction TB subgraph ServiceNowTrigger[&nbsp ServiceNow New record trigger &nbsp] Trigger(Trigger) --- setup1(setup) end subgraph EmailAction[&nbsp Email by Workato Send email action &nbsp] Action1(Action) --- setup2(setup) end subgraph SearchIssues[&nbsp Jira Search issues action &nbsp] Action2(Action) --- setup3(setup) end subgraph CreateIssue[&nbsp Jira Create issue action &nbsp] Action3(Action) --- setup4(setup) end subgraph SendEmail2[&nbsp Email by Workato Send email action &nbsp] Action4(Action) --- setup5(setup) end end CreateRecipe([Create recipe]) -- Configure your recipe --> Configuration --> Workflow([Automated workflow]) ServiceNowTrigger --> EmailAction --> SearchIssues --> CreateIssue --> SendEmail2 classDef default fill:#fff,stroke:#67eadd,stroke-width:2px; classDef WorkatoTeal fill:#67eadd,stroke:#b3e0e1,stroke-width:2px,color:#000; classDef SubgraphDash fill:#e1fffc,stroke:#f66,stroke-width:2px,color:#000,stroke-dasharray: 5 5 class CreateRecipe,Trigger,setup1,Action1,setup2,Action2,setup3,Action3,setup4,Action4,setup5,Workflow WorkatoTeal class ServiceNowTrigger,EmailAction,SearchIssues,CreateIssue,SendEmail2 SubgraphDash

# Create your recipe

Complete the following steps to create a recipe that monitors ServiceNow for newly created incidents and creates a corresponding issue in Jira if an existing issue doesn't already exist:

USE CASES ARE INTENDED AS EXAMPLES ONLY

This use case is intended to serve as an example. Recipe modifications such as trigger and action configuration and conditional logic may require adjustments if you plan to include this recipe in your own workflow.

1

Sign in to Workato and go to the workspace project where you plan to add the recipe.

2

Set up connections for ServiceNow and Jira using the steps in the following sections:

Set up your ServiceNow connection.
1

Click Create > Connection.

2

Search for and select ServiceNow on the New connection page.

3

Enter a name for your ServiceNow connection in the Connection name field.

ServiceNow connection setupServiceNow connection setup

4

Use the Location drop-down menu to select the project where you plan to store the connection.

5

Use the Authentication type drop-down menu to select Username/Password.

6

Enter your ServiceNow Instance name. For example, if your ServiceNow URL is https://acme.service-now.com, the instance name is acme.

7

Enter your ServiceNow username in the Username field.

8

Enter your ServiceNow password in the Password field.

9

Click Connect.

The ServiceNow connector also supports OAuth 2.0 and Password grant authentication methods.

Set up your Jira connection.
1

Click Create > Connection.

2

Search for and select Jira in the New connection page.

3

Enter a name for your Jira connection in the Connection name field.

Jira connection setupJira connection setup

4

Use the Location drop-down menu to select the project where you plan to store the connection.

5

Select your Connection type.

6

Use the Auth type drop-down menu to select your authentication method. Supported options include Basic, API token, OAuth 2.0, and Personal access token.

7

Provide your Host name. For example, if your Jira URL is https://acme.atlassian.net, your host name is acme.atlassian.net.

8

Click Connect.

3

Click Create > Recipe.

4

Provide a name for your recipe in the Name field and select the project in which you plan to store the recipe from the Location drop-down menu.

5

Ensure that Trigger from an app is selected under Pick a starting point and click Start building.

Set up your recipeSet up your recipe

6
Set up your ServiceNow New record trigger.
1

Search for and select ServiceNow in the Choose an app search box.

Choose ServiceNowChoose ServiceNow

2

Select New record (real-time) as your trigger.

Select the New record real-time triggerSelect the New record real-time trigger

3

Select the ServiceNow connection you created in the preceding steps.

4

Use the Table drop-down menu to select Incident.

5

Click Save.

Step summary

This trigger monitors ServiceNow for new incidents.

7

Click + Add step and select Handle errors.

Click Add step > Handle errorsClick Add step > Handle errors

How does the Handle errors control statement work?

The Handle errors control statement allows you to monitor for errors in actions, similar to the try/catch concept in programming languages. When an error occurs, you have the opportunity to:

  • Retry the sequence of actions again, in case it was a temporary error such as network issues.

  • Take remedial actions, such as notifying users of the error through email or error messages in the app, or to carry out a rollback. For example, you can reverse the job by deleting any created or half-created records.

This control statement consists of two blocks: the Monitor block and the Error block. Place the actions that you plan to monitor for errors within the Monitor block. If all actions are successful, Workato ignores the Error block. However, if any action in the Monitor block results in an error, the actions within the Error block are executed.

graph TD A(Monitor action for errors) ---> B((Error found?)) B --> C{Yes} B --> D{No} C --> E(Define how to <br/> handle the error) D --> F(Do nothing) classDef default fill:#67eadd,stroke:#67eadd,stroke-width:2px,color:#000;
8

Click the ••• (ellipsis) next to the placeholder step (step 3) in the recipe editor and select Delete.

Delete the placeholderDelete the placeholder

9

Click + Add step and select IF condition. Make sure to insert the IF condition after the Monitor block (step 2).

Click Add step > IF conditionClick Add step> IF condition

How do IF conditions work?

An IF condition enables you to make decisions based on specific conditions. You can control your recipe workflow by executing different actions depending on whether a condition you specify is true or false.

flowchart TD A([New ServiceNow incident]) --> B(Does the incident description contain \n the string 'Synced to Jira'?) B -->|Yes| C(Send email stating the incident \n is already synced, and stop the job) B ---->|No| E(Search issues in Jira) classDef default fill:#67eadd,stroke:#b3e0e1,stroke-width:2px,color:#000;
10
Set up your IF condition.
1

Map the ServiceNow Description Step 1 datapill to Data field.

2

Use the Condition drop-down menu to select is present.

3

Click + (plus) and select AND to add a second condition.

4

Map the ServiceNow Description Step 1 datapill to Data field.

5

Use the Condition drop-down menu to select contains.

6

Enter Synced to Jira in the Value field.

Configure the IF conditionConfigure the IF condition

7

Click Save.

Step summary

This step checks if the new ServiceNow incident has a description that indicates it has been synced to Jira.

11

Click Select an app and action.

12
Set up your Email by Workato Send email action.
1

Search for and select Email by Workato in the Choose an app search box. The Send email action is selected automatically.

Choose Email by WorkatoChoose Email by Workato

2

Enter the recipient's email address in the To field. If you’re sending the email to multiple recipients, separate their addresses with commas.

3

Enter the following subject in the Subject field:

New incident in ServiceNow creates issue in Jira - Already synced

4

Use the Email type drop-down menu to select Text.

5

Enter the following message in the Message field:

The job is synced from Jira to ServiceNow.
Recipe ID:
Job ID:
Job URL:
6

Map the Recipe ID Properties, Job ID Properties, and Job URL Properties datapills to their corresponding labels in the Message field.

Map datapills to the Message fieldMap datapills to the Message field

7

Click Save.

Step summary

This step sends an email to a specified recipient communicating that this ServiceNow incident is already synced to Jira.

13

Click + Add step and select Stop job. Place this step immediately after the Send email via Workato action (step 4), ensuring it is within the steps executed when the IF condition evaluates to true.

Click Add step > Stop jobClick Add step > Stop job

How does the Stop control statement work?

The Stop control statement ends a single job from being processed any further. It is usually used in cases when there is an error in the business logic and further processing of the job is not required.

The Stop statement can be configured to mark the job as failed or successful.

flowchart TD B(Is the statement true?) B -->|Yes| C(An email notification is sent, \n the job is stopped, \n and the job is marked as successful) B ---->|No| E(The job is stopped) classDef default fill:#67eadd,stroke:#b3e0e1,stroke-width:2px,color:#000;
14
Set up your Stop control statement.
1

Use the In job report, mark stopped job as drop-down menu to select Successful.

Step summary

This step stops the job and marks it as successful if the ServiceNow incident has already been synced with Jira.

15

Click + Add step and select Action in app. Place this step within the steps executed when the IF condition evaluates to false.

Click Add step > Action in appClick Add step > Action in app

16
Set up your Jira Search issues batch action.
1

Search for and select Jira in the Choose an app search box.

Choose JiraChoose Jira

2

Select Search issues (batch) as your action.

Select the Search issues batch actionSelect the Search issues batch action

3

Switch the Summary field to formula mode.

4

Map the ServiceNow Number Step 1 datapill.

5

Enter + " - " + to add a hyphen.

6

Map the ServiceNow Short description Step 1 datapill.

Configure the Summary fieldConfigure the Summary field

7

Click Save.

Step summary

This step searches for Jira issues that use the specific naming pattern corresponding to a ServiceNow incident.

17

Click + Add step and select IF condition.

IF conditionIF condition

18
Set up your second IF condition.
1

Map the Jira ID Step 6 datapill to Data field.

2

Use the Condition drop-down menu to select is not present.

Configure the second IF conditionConfigure the second IF condition

3

Click Save.

Step summary

This step checks whether the result of the search returned a matching Jira issue.

19

Click Select an app and action.

20
Set up your Jira Create issue action.
1

Search for and select Jira in the Choose an app search box.

Choose JiraChoose Jira

2

Select Create issue as your action.

Select the Create issue actionSelect the Create issue action

3

Use the Project issue type drop-down menu to specify the Jira issue type. For example, Bug. The options in this drop-down menu depend on the issue types configured in your Jira project.

4

Switch the Summary field to formula mode.

5

Map the ServiceNow Number Step 1 datapill.

6

Enter + " - " + to add a hyphen.

7

Map the ServiceNow Short description Step 1 datapill.

Configure the Summary fieldConfigure the Summary field

8

Switch the Description field to formula mode.

9

Map the ServiceNow Description Step 1 datapill.

10

Enter + "\n" + "Synced to Jira".

Configure the Description fieldConfigure the Description field

11

Switch the Priority name field to formula mode and enter the following:

{ "5" => "Lowest", "4" => "Low", "3" => "Medium", "2" => "High", "1" => "Highest" }  [ PRIORITY_DP ]

Replace PRIORITY_DP with the ServiceNow Priority Step 1 datapill.

Configure the Priority name fieldConfigure the Priority name field

12

Map the ServiceNow Due date Step 1 datapill to the Due date field.

13

Click Save.

Step summary

This step creates a Jira issue that corresponds to the ServiceNow incident.

21

Click + Add step and select Action in app. Place this step immediately after the Create issue action (step 8), ensuring it is within the steps executed when the IF condition evaluates to true.

22
Set up your ServiceNow Update record action.
1

Search for and select ServiceNow in the Choose an app search box.

Choose ServiceNowChoose ServiceNow

2

Select Update record as your action.

Select the Update record actionSelect the Update record action

3

Use the Table drop-down menu to select Incident.

4

Map the ServiceNow Sys ID Step 1 datapill to the Sys ID field.

5

Expand Update record values and map the ServiceNow Description Step 1 datapill to the Description field.

6

Switch the Work notes field to formula mode.

7

Map the ServiceNow Work notes Step 1 datapill.

8

Enter + "\n" + " Synced to Jira" + "\n" + " Jira ID: " +.

9

Map the Jira ID Step 8 datapill.

Configure the Update record values fieldConfigure the Update record values field

10

Click Save.

Step summary

This step updates the ServiceNow incident record to confirm that it is synced with Jira and adds the Jira issue ID to the work notes.

23

Locate the Error found? block, and click Select an app and action (step 11).

Click Select an app and actionClick Select an app and action

24
Set up your second Email by Workato Send email action.
1

Search for and select Email by Workato in the Choose an app search box. The Send email action is selected automatically.

Choose Email by WorkatoChoose Email by Workato

2

Enter the recipient's email address in the To field. If you’re sending the email to multiple recipients, separate the email addresses with commas.

3

Enter the following subject in the Subject field:

New incident in ServiceNow creates issue in Jira - Failed

4

Use the Email type drop-down menu to select Text.

5

Enter the following message in the Message field:

Recipe URL:
Job ID:
Job URL:
Recipe failed: 
6

Map the Recipe ID Properties, Job ID Properties, Job URL Properties, and Error message Step 10 datapills to the corresponding labels in the Message field.

Configure the Message fieldConfigure the Message field

7

Click Save.

Step summary

This step sends a failed job notification email to a specified recipient.

Your ServiceNow and Jira recipe is ready to test and implement.

Example recipe configuration.

ServiceNow and Jira recipeServiceNow and Jira recipe

flowchart TD subgraph Monitor["Monitor the following actions for errors:"] direction TB IfCondition{"Is a ServiceNow description present, \n and does it contain 'Synced to Jira'?"} StopJob(["Stop job"]) SendEmail["Send email"] SearchIssues["Search issues in Jira"] IfCondition2{"Was a Jira ID not found?"} ServiceNow["Update record in Incident \n table in ServiceNow"] CreateJiraIssue["Create issue in Jira"] end subgraph ErrorFound["Error found?"] direction TB DonotRetry["Don't retry the failed step"] SendEmail2["Send email"] end subgraph RecipeSteps[" "] direction TB ServiceNowTrigger["New record in Incident table in ServiceNow"] Monitor ErrorFound end IfCondition -- Yes --> SendEmail SendEmail --> StopJob IfCondition -- No --> SearchIssues IfCondition2 -- Yes --> CreateJiraIssue CreateJiraIssue --> ServiceNow StartRecipe(["Start recipe"]) --> RecipeSteps RecipeSteps --> EndRecipe(["End recipe"]) ServiceNowTrigger --> Monitor Monitor --> ErrorFound SearchIssues --> IfCondition2 DonotRetry --> SendEmail2 classDef default fill:#fff,stroke:#67eadd,stroke-width:2px; classDef WorkatoTeal fill:#67eadd,stroke:#b3e0e1,stroke-width:2px,color:#000; classDef SubgraphDash fill:#e1fffc,stroke:#f66,stroke-width:2px,color:#000,stroke-dasharray: 5 5 classDef WorkatoPink fill:#f3c1c2,stroke:#f3c1c2,stroke-width:1px; class StartRecipe,ServiceNowTrigger,IfCondition,SendEmail,SearchIssues,IfCondition2,CreateJiraIssue,ServiceNow,DonotRetry,SendEmail2,EndRecipe WorkatoTeal class Monitor,ErrorFound SubgraphDash class StopJob,EndRecipe WorkatoPink


Last updated: 12/9/2024, 9:57:19 PM