How to call and pass parameters to External jar file placed on mid server via business rule ?

jkishan
Giga Contributor

Can anyone guide me on how to call and pass parameters to jar files placed on mid server via business rule onSubmit of incident

1 ACCEPTED SOLUTION

jkishan
Giga Contributor

Hi all,



I was able to successfully able to call the custom jar deployed on mid-server via business rule.



var id=current.sys_id;


var desc= current.description;


  var _ecc = new GlideRecord("ecc_queue");


_ecc.initialize();


_ecc.agent = "mid.server.server"; //put your MIDserver name here


_ecc.queue = "output"; //Hard coded value


_ecc.topic = "Command"; //Hard coded value


_ecc.source = "Run command"; //put any string value


_ecc.name="PowerShell name"; // put your PowerShell or command shell here


_ecc.payload='<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="name" value=" Your Command here'"/></parameters>'; //Hard coded value


_ecc.insert();




Regards


Jai Kishan


View solution in original post

4 REPLIES 4

tony_barratt
ServiceNow Employee
ServiceNow Employee

Hi Jal,



There is some relevant info here:


MID SERVER



What steps have you already carried out? Have you already deployed the jar file on the MID Server?



Best Regards



Tony


Hi Tony,



Yes I have deployed the jar onto my mid server, I am able to execute the call file from ECC queue (Step followed as given in the video).


Now I am looking to execute the jar through workflow or through business rule on incident table.



Regards


Jai


jkishan
Giga Contributor

Hi all,



I was able to successfully able to call the custom jar deployed on mid-server via business rule.



var id=current.sys_id;


var desc= current.description;


  var _ecc = new GlideRecord("ecc_queue");


_ecc.initialize();


_ecc.agent = "mid.server.server"; //put your MIDserver name here


_ecc.queue = "output"; //Hard coded value


_ecc.topic = "Command"; //Hard coded value


_ecc.source = "Run command"; //put any string value


_ecc.name="PowerShell name"; // put your PowerShell or command shell here


_ecc.payload='<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="name" value=" Your Command here'"/></parameters>'; //Hard coded value


_ecc.insert();




Regards


Jai Kishan


Hi jkishan,

I have execute the below command in java using the jar file

java -jar vosp-api-wrappers-java-20.3.6.1.jar -vid xxxxxx -vkey xxxxxx -action getappbuilds -outputfilepath c:\javawrappers\getappbuilds.xml

it's loading the data in the specified output file.

Now i want to run the same command so i need to pass the -vid,-vkey and -action.how to do it,could you suggest me.

 

Thanks,

Pavani.