- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 08:23 AM
Hi All,
I am new to this software and recently completed the ServiceNow
Administrator training. We have a lot of customized automation running from
local batch files or SQL jobs with the current ITSM software we are running
(Cherwell) and I am wanting to know how to integrate buttons or preferably a
drop down menu onto the incident form with a list of UI Action buttons to
execute various local automation scripts (mostly batch files or cmd prompt
commands) as well as pass them a few values from the filled out incident form
and I'm not sure where to start. Any help would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2014 01:19 PM
Hi Jared,
Within IE it may be possible with an ActiveX controller to open the command prompt. Generally speaking web browsers do not grant access to local system files or applications though as this is considered to be a Security issue. If it were easy for web browsers using javascript to run Shell commands, malicious javascript could be injected into a web page which could completely undermine the security of your systems.
That said, ActiveX controllers let you do all sorts of things with javascript in IE only. Here is an example for javascript that could run shell scripts: javascript - Using a WScript.shell activeX to execute a command line - Stack Overflow.
If you were to implement a client side UI Action using a script like that, you could possibly achieve this without a MID Server. This of course is a use at your own risk and would only work with IE. Personally, I've never tried this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 09:32 AM
Just right off the cuff: I have done something similar to this in order to schedule an on demand vulnerability scan of a particular IP.
There is a table called "IP Scans". One of it's values is a "processed" flag. The "scan" UI action adds an entry to that table for the desired IP address.
The local server queries this table every few minutes for any records where "processed" is not set. For each record, it will initiate the scan script, and then will update that record of the ServiceNow IP Scan table with the results and setting "processed" to true.
A business rule on ServiceNow recognizes the updated record with "processed" set and carries on from there.
So how does this apply to you?
You could have a similar table that also contains information about what script you want to run (and any arguments).
A script on your local server could fetch the unprocessed records from the table and run the appropriate job, and then update the ServiceNow record as processed (and with whatever other results you want to include).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 10:58 AM
In addition to Geoff Cox's approach, there are a couple other methods:
1. Orchestration: This is a paid plugin offered by ServiceNow that uses workflows within ServiceNow to *ahem* Orchestrate running shell scripts and other 'behind the firewall' activities via the MID Server. This is ServiceNow's flagship automation suite.
2. MID Server: You can actually use a MID Server without Orchestration (the MID Server is a free download). The MID server uses the ECC Queue which is ServiceNow's native version of what Geoff was discussing. By writing a custom java JAR file that handles the batch file execution or running SQL scripts and including it in the MID Server, you can fire those jobs easily. Here's a GREAT youtube on it: Leveraging Custom JAR files on a MID Server - YouTube
The bottom line here is that you will need to construct or configure some way for the local server and the ServiceNow cloud server to communicate. Your UI actions will then engage with that communication channel. Orchestration and the MID server both use the ECC table as the communication channel. Geoff's method is basically rolling your own MID Sever which can be advantageous if you don't know Java or don't want to mess with a MID server but you can easily consume ServiceNow's web services with a different programming language or framework.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2014 01:07 PM
Excuse my ignorance with all of this but wouldn't it be possible to write a UI Action javascript that would lanch the command prompt along with passing it a few field values from the incident form and have the command prompt run the batch file with the incident form values as arguements for the batch file? That's kind of more along the lines of what I am wanting to do. I would hope I don't need to have a mid server or paid for plugin to run that sort for script. I am no javascript expert but I guess it just seems feasible with what is already provided with the system, using a UI action javascript and somehow putting those different ui action buttons on a dropdown list so the form isn't too cluttered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2014 01:19 PM
Hi Jared,
Within IE it may be possible with an ActiveX controller to open the command prompt. Generally speaking web browsers do not grant access to local system files or applications though as this is considered to be a Security issue. If it were easy for web browsers using javascript to run Shell commands, malicious javascript could be injected into a web page which could completely undermine the security of your systems.
That said, ActiveX controllers let you do all sorts of things with javascript in IE only. Here is an example for javascript that could run shell scripts: javascript - Using a WScript.shell activeX to execute a command line - Stack Overflow.
If you were to implement a client side UI Action using a script like that, you could possibly achieve this without a MID Server. This of course is a use at your own risk and would only work with IE. Personally, I've never tried this.