Enterprise Architecture Blog Posts
Need a little more room to share your thoughts with the community? Post a blog in the SAP Enterprise Architecture group to explain the more complex topics.
cancel
Showing results for 
Search instead for 
Did you mean: 
Krutika_More1
Explorer
5,308

Lengthy yet interesting blog! 😊

Contents/Agenda:

  • Introduction to ServiceNow
  • Introduction to SAP OpenConnectors
  • ServiceNow Configuration
  • OpenConnectors Configuration
  • SAP CI IFlow Scenario & Steps
  • Conclusion & Incident Record in ServiceNow

1. Introduction to ServiceNow (SNOW): 

  • What is ServiceNow?
    - ServiceNow is a cloud-based platform that provides enterprises IT Service Management (ITSM).

    - It is designed to automate and streamline IT service delivery processes.
  • Key Features:
    - Incident Management

    - Problem Management
    - Change Management, etc.

2. Introduction to SAP OpenConnectors:

  • What is OpenConnectors?
    - Open Connectors are part of the SAP Integration Suite, designed to simplify the process of connecting with third-party applications.

    - They provide pre-built, standardized connectors that enables seamless integration.
  • Key Features:
    - Pre-Built Connectors

    - Unified API, etc.

3. ServiceNow Configuration: 

Log in to the ServiceNow developer (https://developer.servicenow.com/dev.do) portal and create an instance.
You will get the instance URL: https://<instance_name>.service-now.com, Username and Password.
Once the Instance is created and you log in to the ServiceNow tool, your screen should look like below.

Krutika_More_0-1722693181339.png

In the Filter Navigator search bar, search for OAuth and click on Application Registry.

Krutika_More_1-1722693212087.png

Now click on New --> Select “Create an OAuth API endpoint for external clients”.

Krutika_More_2-1722693259064.pngKrutika_More_3-1722693265568.png

Enter the OAuth details and click on Submit:

  1. Enter the Name.
  2. Enter the Redirect URL: https://auth.cloudelements.io/oauth
  3. Client ID will be auto generated.
  4. ⁠Client Secret will be auto generated when you submit the OAuth details.

Krutika_More_4-1722693311833.png

  • Note down the Client ID and Client Secret.

Create Users and Groups (assign team members to their respective groups).

Krutika_More_5-1722693399008.png

4. OpenConnectors Configuration:

Log in to OpenConnectors and configure the ServiceNow OAuth connector.

Krutika_More_0-1722693911867.pngKrutika_More_1-1722693920717.png

Enter the ServiceNow details in the tab below and click on Create Instance.

Krutika_More_2-1722693934452.png

You will now be redirected the screen below.

Krutika_More_3-1722693954248.pngThe ServiceNow instance is ready, and we can test it. 👆

Click on Instances --> API Docs.

Krutika_More_7-1722694167694.png

Scroll to the ping section and click on Try it out.

Krutika_More_6-1722694124561.png

Click on Execute.

Krutika_More_4-1722693976981.png

You can see the response below. SNOW Instance is reachable from OpenConnectors.

Krutika_More_0-1722771914009.png

5. SAP CI IFlow Scenario: Create an IFlow using a timer and simple 1:1 mapping for testing convenience.
When the message fails, a ticket will be assigned to CI.
The CI team can then take appropriate actions on the ticket.

Krutika_More_0-1722768072023.png

Step 1: Use Timer --> To trigger the interface.

Krutika_More_1-1722768110269.png

Step 2: Set interface priority and Save XML Payload

  • 2.1: In the Content Modifier, set the interface priority under the header. 

Krutika_More_0-1722771319633.png

  • 2.2: Save the XML payload in the message body.

Krutika_More_2-1722768811204.png

Step 3: Message Mapping: Map source and target fields (1:1). As we are not passing the “heading” field (refer to step 2.2), the mapping will fail.

Krutika_More_2-1722768318010.png

Krutika_More_3-1722768327082.png

Exception Subprocess: In the event of mapping failure, the Exception Subprocess will be triggered.

Step 1: Use Error Start Event --> To trigger the Exception Subprocess.

Krutika_More_0-1722768634748.png

Step 2: Configure the Content Modifier for assigning tickets to different team members.

  •      2.1: Set the header in the content modifier (Ticket assigned to team members).

Krutika_More_0-1722768232366.png

  •     2.2: Navigate to the message body, set the type as expression and maintain the below XML data.

Krutika_More_1-1722768265138.png

  • 2.3: In message mapping, map the “assigned to” field using fixValues (maintain the team members under the Advanced tab) mapping function.
    Tickets will be assigned to different team members. For example, the first failed message will assign a ticket to the first team member listed in the fixValues.

Krutika_More_0-1722770079521.png

Krutika_More_2-1722770222144.png

Maintain the number ranges under Security Material as shown below.

Krutika_More_0-1722770408488.png

Step 3: Configure Content Modifier for Incident creation

  • 3.1: Set headers in the content modifier as shown below.

Krutika_More_0-1722768974686.png

  • 3.2: Navigate to the Message Body tab, set the Type as Expression and maintain the provided code as the body (Obtained from OpenConnectors --> Instances --> API Docs --> Scroll to incidents (POST) --> Try it out --> Execute)

Krutika_More_2-1722769026523.png

Code:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
<active>true</active>
<assigned_to>${header.user}</assigned_to>
<activity_due>${date:now:dd-MM-yyyy HH:mm}</activity_due>
<assignment_group>CPI_Support</assignment_group>
<business_duration>${date:now:dd-MM-yyyy HH:mm}</business_duration>
<caller_id>CPI User</caller_id>
<closed_at>${date:property.CamelCreatedTimestamp+48h}</closed_at>

<description>
Alert Time : ${date:now:dd-MM-yyyy HH:mm} UTC
Message ID : ${property.SAP_MessageProcessingLogID}
Service Name : SAP CI
Interface : ${header.Interface_Name}
**
Error Details : ${header.Error_Details}
Message Details: <Messages: SAP CPI tenant URL>
</description>
<impact>${header.Priority}</impact>
<knowledge>true</knowledge>
<made_sla>true</made_sla>
<opened_at>${date:now:dd-MM-yyyy HH:mm}</opened_at>
<service>CPI Production</service>
<short_description>CPI alert for ${header.Interface_Name}</short_description>
<state>In Progress</state>
<subcategory>Internal Application</subcategory>
<urgency>${header.Priority}</urgency>
<work_start>${date:now:dd-MM-yyyy HH:mm}</work_start>
</root>

Step 4: Convert XML to JSON
Use a converter to change the XML data to JSON since Open Connectors accepts only JSON data.

Step 5: Request Reply to ServiceNow
Use the request reply step to send and receive incident details back from ServiceNow.

Krutika_More_3-1722769164922.png

Step 6: Configure Open Connectors Adapter.
In the connection tab of Open Connectors adapter, do the configuration as shown below.

Krutika_More_1-1722770466050.png

Krutika_More_0-1722770575940.png

  • How to configure the Credential Name for Open Connectors?
    Navigate to the Monitor tab in CI: Monitor --> Manage Security Material --> Create --> User Credentials --> Deploy

Krutika_More_0-1722769680740.png

  • Note: Exclude the commas and space while entering the values in user credentials.

Step 7: End the Flow.

Krutika_More_0-1722769793925.png

Deploy the IFlow: Once deployed, the message will fail in the mapping step, triggering the exception subprocess to send the message OpenConnectors.

6. Conclusion & Incident Record in ServiceNow: With this approach, incident creation is automated based on failures.

A new incident can be seen in ServiceNow.

Krutika_More_1-1722693796926.png

Thank you very much!

Keep blogging!! 😊 Feel free to post your queries, and I'll be more than happy to help resolve them.                                   

2 Comments