Get the instance name from BusinessRule in ServiceNow to avoid Hardcoding.
Create a Global variable and assign the instance to it and here is the code below:
//Getting the instance name -- Check sys_properties table and find the value of instance_name
var instancename = gs.getProperty('instance_name');
gs.log('instance name is -->' +instancename);
var env = ' ';
//check if instance name contains dev or uat or anything
if(instancename.indexOf('dev') > -1)
{
env = "DEV";
gs.log('it is instance-->' +env);
}else if(instancename.indexOf('uat') > -1 )
{
env = "UAT";
gs.log('it is instance-->' +env);
}else
{
env = "PROD";
gs.log('it is instance-->' +env);
}
var midserver = 'MIDServer_'+env+'15_1';
var mid = new GlideRecord('ecc_agent');
mid.addQuery('name',midserver);
mid.query();
if(mid.next())
{
}
Subscribe to:
Post Comments (Atom)
Discovery troubleshooting | Error messages
Discovery troubleshooting | Error messages - Support and Troubleshooting (servicenow.com) Description Learn how to resolve common Discover...
-
Steps to Debug Inbound REST API Calls in Service Now: 1. Make sure the property “ glide.rest.debug ” is set to true under sys_prop...
-
Error Log - [ecc_agent_status] table record missing for MIDSERVER "Midserver name" : no thrown error in Logs. Cause: ( Clon...
-
Get the instance name from BusinessRule in ServiceNow to avoid Hardcoding. Create a Global variable and assign the instance to it and he...
No comments:
Post a Comment