Populate field using mid server and query of sql database

robhaas
Tera Contributor

I am trying to determine if it is possible to use a mid server and query a sql database and return a value to a field in servicenow. Basically, I am looking for a live query, but not necessarily import. Take the following for example:

ElementApprover
Element1

Let's say I have a list of all elements and their approver in a sql database. Can I run a live query on update of the form OR by clicking a UI Action that will connect to the sql database using an established mid server, search for the Element (in this case 'Element1'), and find the approver. Upon finding the approver, pass that data back to the form and populate the Approver field.

SN uses Mid Server to connect to sql server > Query sql server for Element1 > Find Element1 Approver > Pass Element1 Approver back to SN

End result:

ElementApprover
Element1User1

I'm just trying to figure out if this is doable, and what direction I should take to develop this. I do already have a mid server and a connection using it to import data into my instance, but I really just want to query the database and pass data back. All help is greatly appreciated in advance.

4 REPLIES 4

phsdm
Giga Expert

The SCCM integration does this kind of thing, so it might provide an example.   I think it adds to the basic pattern.   (Which I obviously don't know, or I would have told you...)



I believe you create a scheduled job that runs a query using a jdbc data source.   If you are accessing SQL Server via Windows authentication with an account different from your discovery account, you'll need to configure another MID Server Windows Service and change its credentials for the service.   (That last sentence made sense before I tried to proofread it.)   There is some sort of Windows MID Server proxy that might help with this, but I don't know how to route requests to specific proxy services.   Maybe it has something to do with MID Server capabilities.


akillius
Kilo Expert

Just curious if you ever found a way to get this to work.


Juan Rondon
Tera Contributor

Hello @robhaas

Did you ever find the solution for what you were trying to accomplish?

abhaydahiya65
Tera Contributor

Hi @robhaas@Juan Rondon@akillius@phsdm,

 

Wanted to ask if anyone found the solution for this implementation?