Endevor Package Integration with ServiceNow, Part 2

Thomas McQuitty
Modern Mainframe
Published in
4 min readNov 30, 2023

In Part One, we used Endevor REST Services to perform actions with packages. In Part Two, we explore integrating with the Zowe CLI to perform actions in Endevor.

ServiceNow’s REST interface is useful but it has limits. For example, it cannot call multipart/form-data. With the Endevor REST API, the Create Package action requires multipart/form-data.

Endevor REST API documentation

This means you can’t create a multipart data submission with ServiceNow. At least not right now.

So what other solutions exist to create the package? The Zowe CLI can perform that action using the Endevor for Zowe CLI plugin.

Using the Zowe CLI

The Zowe CLI provides an easy interface to Endevor. First, we need to install the Zowe CLI. ServiceNow’s MID server uses a service account, with its own login and credentials. We may not be able to log into that account directly, depending on the platform. You will need to install Zowe globally on that machine. Using the NPM installation method, be sure to use the -g flag to install Zowe globally. You may also need to install the plugins for that user or use a global location for all the plugins for that machine (See the Zowe Documentation for that).

We need to create a profile for the connection information to Endevor in Zowe. If you are using Zowe V2, a Team Config is a great place to start. Once you have the connection information, we can focus on the operation.

Using the web help, we can view all the documentation in a browser making it easier to read.

zowe --hw

Shows examples to call the command line.

Web Help output example

This example creates a package with the name “packageName”, a description of “package description” from a local file.

We want information from ServiceNow to populate the package name and description. We can use a batch file, or other script, to pass the information from ServiceNow to the command line for Zowe.

Using the MID Server scripts in ServiceNow, we can create a script that is loaded onto the MID Server. This is useful, as you will not need direct access to the MID Server host. If you have access to the host, you can also create the file there.

The script is pretty simple, and you can wrap it with any functionality you’d like. In my case, I log a little output to a file so I can track the values passed to the script.

Zowe Script wrapped in a Batch file

Once the script has been created, we need to define the action so the script can be used via workflows. Creating the action is pretty simple, we just need to define our inputs and outputs and specify the script to be called. This script was a modification of the example provided by ServiceNow.

We define the inputs for the action

The inputs are used to pass information from the workflow and translated into available options in the script.

Script Actions

The script specifies where the script can run, then we translate the inputs into variables for the script. The script itself is mainly boilerplate, however we may want to do things such as scrubbing inputs. This removes quotes from the input string, in our case the short description (which will be defined from the workflow) so it doesn’t interfere with script.

Note that the script is defined in the scripts folder, and it places the action on the ECC Queue, which the MID server will execute.

Once the script is created and the action available, we now use it via workflows. The workflow determines when the action will occur.

Workflow to drive script

This workflow is triggered on every update when the Create Change Package field is set to true and when the Endevor Change Package field is empty.

The first action executes the script and we pass through the ServiceNow ticket number as the package name (pkgName) and the description from the form’s Short Description field.

Finally, it will update the incident with the ticket number, in this case.

Once this has been created and activated, it will run every time the trigger condition is met. This will create a change package in Endevor.

This is very basic, as we can also do more complicated actions such as populating the Change Package SCL, etc.

What Next?

If you are looking for help with this please reach out and we are more than happy to have a conversation and assist you. If you’d like to see a demonstration, please reach out.

What would you like to see this do next? I am looking for ideas on where to take this integration next.

Learn More

Learn more about Zowe at this site; more Zowe blogs here.

--

--

Thomas McQuitty
Modern Mainframe

I call myself a professional automator. Primarily focused on customer facing activities, I use tools like Python to automate mundane work.