Introduction
Azure DevOps is a platform used to collaborate between development and operations, resulting in effective and efficient software delivery. The engineers working on Incident/Problem may need to create a bug in ADO for the engineering team to work on this. ServiceNow Incident/Problem may need to create a bug in ADO for the engineering team to work on this.
Problem Statement
This results in switching between platforms and communicating in multiple channels to have information regarding both platforms may lead to misinformation, cost, time, and workforce and, therefore, inefficient delivery.
The Impact on the Business is:
- Improper Management of Information
- Errors Caused due to Duplication of Updates in Multiple Applications
- The Effort needed to update, manage, and track activities in different instances
- The Effort involved results in Time and Manpower, which indirectly contributes to the Operational Cost
Solution Consideration
This integration is introduced to address this issue and effectively and efficiently communicate between the tools.
The Azure and ServiceNow Integration with DevOps helps create work items from ServiceNow and update the fields in both systems in a bi-directional flow to support the Engineers and Engineering team to work together effectively.
What is a work item?
Work items are records in Azure DevOps used to track anything you need to track. Each work item represents an object stored in the work item data store. Each work item is based on a work item type (Bug, Epic, Task, etc.) and is assigned a unique identifier within an organization or project collection.
The REST Integration process followed in this case, we use the work item type Bug for a problem in ServiceNow, and the relationship is an incident to the situation to ADO, in that order.
As the flow indicates above, a problem record is created for an incident. A UI action creates an ADO work item from the problem. Any relationship of ADO work item with ServiceNow is directly linked to the situation to have one to one relationship.
APIs used in the REST Integration.
Action | Method | API |
---|---|---|
Create Work Item | POST | https://dev.azure.com/{organization}/{projectY/_apis/wit/workitems/${type)?api-version=5.1 |
Get Work Item | GET | https://dev.azure.com/forganization}/{project}/_apis/wit/workitems/{id}?api-version=5.1 |
Get batch of Workitems | POST | https://dev.azure.com/{organization}/{project}/_apis/wit/workitemsbatch?api-version=5.1 |
Modify Work Item | PATCH | https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=5.1 |
Get Comments | GET | https://dev.azure.com/{organization}/{project}/_apis/wit/workltems/{workltemldy comments/{commentid}?api-version=5.1-preview.3 |
Get field values(List of processes) | GET | https://dev.azure.com/{organization}/_apis/work/processes/lists/{fiekdvalues} |
Add Attachment | POST | https://dev.azure.com/{organization}/{project}/_apis/wit/attachments/{filename)?api-version=5.0 |
Processes in Azure and ServiceNow Integration
Creation of Work Item:
As the relationship created is Problem to ADO, the work item is generated from a problem record using UI action.
This will open a wizard with all the fields required to create a work item. The fields on the wizard will be mapped to the ADO work item fields, and the Record Generator script will be written to push the fields and create the work item with the API given above.
Once the work item is created, a work item ID is generated. This can be used to create a URL that will direct to the work item on the ADO platform.
Note: It is necessary to match the values in the ADO and SNOW to create the work item without any error.
Bi-Directional sync between ADO and ServiceNow
Once the work item is created, specific fields are synced between the platforms to have real-time and accurate data to help the engineers get an update on it.
ServiceNow to ADO
- To sync fields from ServiceNow to ADO, business rules written on update and change of the fields specified and pushed onto the work item using API Modify Work Item as stated above in the table.
- To add an attachment from ServiceNow to ADO business rule is used with the API Add Attachment to send various types of files on insert on the attachment table for a problem record
ADO to ServiceNow
- To bring in the updates, a scheduled job is set up every 5- 10 minutes based on the requirement. This scheduled job will pick a batch of 200 ADO IDs from ServiceNow and use API Get Batch of Work items to bring in all the updates for the fields necessary. Once the updates are brought in, it is added to a staging table from which it is mapped to the problem table with the respective fields.
- Comments are also synced from ADO to ServiceNow using the same scheduled job but with API Get Comments and added to a staging table, which is updated in the journal entry after that.
Note:
- A JSON file is created to determine which fields are to be created, synced, and the domain of the ADO work item.
- Properties are set to define domains (Project) of the ADO work item
- A script is created to hold all the functions called to create, modify, match values, etc.
Ex: To update commercial priority onto ADO, a business rule is written on the update, which would call a function from the script, including the Modify Work Item API. Also, call the convert commercial priority function to convert values to match that from ADO.
Benefits
Connectivity between Azure and ServiceNow integration, reduces Effort, Time, Cost, and Manpower and increases efficiency as there is less room for errors and manual activities.
Recommended Best Practices
- Keep the number of ADO IDs of a batch less to avoid issues in scheduled job execution
- Make sure the values of a field from both platforms match exactly
- Centralise as much functionality as possible in one platform
- Be cautious of looping when integrating (Bi-directional)
Conclusion
This integration helps create a work item directly without switching between platforms. Support engineers can update information from, and the Engineering team can update information on ADO, and both parties will be on the same page resulting in faster and quicker resolution.