Integrate ServiceNow and SharePoint Using Microsoft Flow to Create an IT Support Ticket

Recently, I was asked to explore options to integrate SharePoint IT Support Request Form with ServiceNow available on the corporate intranet.

The existing integration with JavaScript extracting data from an email sent through a SharePoint workflow was very fragile and often tickets were not generated in the ServiceNow incident table.  I tried improving the existing process but wasn’t successful.  There is where once again Microsoft Flow came to rescue and more importantly that I don’t have to write JavaScript code (BTW, I do love JavaScript!!).  I really find it amazing how Microsoft Flow can solve business automation problems so easily.  There is a ServiceNow connector available in Flow now but it is ‘Premium’ which means $$$, but we will be doing this through HTTP Action making a POST request to ServiceNow REST API and good news is HTTP connector is free!

Business Scenario:

  • Staff using IT support request form (SharePoint custom list) available on the corporate intranet
  • Send a confirmation email to the person created a request
  • Create a ticket in the ServiceNow incident table
  • Update the ticket number back to SharePoint list for any future verification.

Prerequisite from ServiceNow:

  • A user account with appropriate permission to create an entry in the incident table. More information here.
  • Method URI which can be generated through ServiceNow REST API Explorer.
  • JSON response to create a payload and parsing the JSON object – I have selected only few fields required for this blog, but you can select more fields as appropriate for your scenario
  • Setup REST Auth 2.0 in ServiceNow. For this blog, I am using Basic authentication which is not secure (plain text).

I have a custom list with only three fields.  I have customised the Form using PowerApps to disable the Incident Number field.  We can hide this field if needed e.g. don’t show this if it is a New request but for Edit and View make it disabled.

HTTP POST request to ServiceNow REST API: I generated this through ServiceNow REST API Explorer (amazing tool, if one thing SharePoint could learn from ServiceNow that would be this tool!).  Few things to note: I have set sysparm_exclude_reference_link to ‘True’ in order to set the name of the user to contact field. Otherwise, this request by default return an object which is a link to Users’ table.  Also, I am passing all the fields required in the URL parameters to keep the response clean.  The POST request will work without any parameters but the HTTP response received will be a very long and with necessary information which is not required.

https://dev40105.service-now.com/api/now/table/incident?sysparm_exclude_reference_link=true&sysparm_fields=number%2Ccaller_id%2Cshort_description%2Cdescription

I am using Basic authentication with my username and password with the appropriate role assigned through ServiceNow.

Parse the JSON object received after the request was successful.  This will allow us to update the Incident Number returned from ServiceNow to SharePoint list.

{
“result”: {
“number”: “INC0010007”,
“short_description”: “Small Problem Description”,
“caller_id”: “SharePointer”,
“description”: “Big description for a small problem”
}
}

Lastly, update the SharePoint list item with the Incident Number received from the response.

Here is how the full Flow looks like:

 

Please follow and like us:
error

2 Comments

Githin George · May 16, 2020 at 10:32

I have setup a similar app along with HTTP POST request, and parse JSON.
However, when the flow runs, the result has the Incident number. but it doesnot update to Sharepoint Site.

    SharePointer · May 25, 2020 at 22:14

    Check the SharePoint update action and ensure it is updating correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.