PARSE INFO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 07:57 PM - edited ‎10-05-2023 02:18 PM
Hello can anyone assist on script, trying to parse MSSQL15.MSSQLSERVER to be Put in table cmdb_ci_db_mssql_instance on instance_name field. this is coming from running process key parameters (running_process_key_parameters) field. I will be using a business rule, but the string below will not always be the same, the running process key parameters field will have different data, so will need to call the running process key parameters, parse and in put in the instance name field..
from this "E:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn\sqlservr.exe"-sMSSQLSERVER
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2023 09:42 PM
Hi @Dallas2
You can try Before/After insert/update Business rule on "cmdb_ci_db_mssql_instance" table as per your need :
/*get the value from field*/
var param = current.getValue('running_process_key_parameters');
var inst_name = param.split('\\')[3];
current.instance_name = inst_name;
have a try...!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 05:38 AM
Yes, i will be using it in a business rule/// i will give it a try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 01:50 PM
Hello I tried it, and did not work, maybe there is something missing, i provided some snip its of the sql form, highlighted in yellow the 2 main fields, from running process to instance name fields and business rule, form, to fill out, now the information in the running process key parameters is not the same, it will all be different... can you please advise....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 10:32 PM
Hi @Dallas2
As you mentioned ,"running process key parameters" will be different - can you give us some more examples of running process key parameter values.
Follow the below steps for current scenario :
Step 1: Create Business rule ( here for demo I have created Before - insert business rule )
So whenever record is created then it will update the instance name
Script :
(function executeRule(current, previous /*null when async*/ ) {
/*get the running_process_key_parameters value */
var param = current.getValue('running_process_key_parameters');
if (param) {
var inst_name = param.split('\\')[3];
current.instance_name = inst_name;
}
})(current, previous);
Output :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2023 06:19 AM