How we can fetch three different instances and set the logic within the same script via schedule job

Abhilasha_123
Tera Contributor

Hi Team,

 

We have a requirement for removing the inactive user reference from assignment data lookup, report and knowledge base table from three different instances.
Suppose these are the three instances

1)https://ab.service-now.com/ 

2)https://abc.service-now.com/

3)https://abcd.service-now.com/
How we can fetch the instance name and based on the instance name how we can set the logic within the same script via scheduled job.
Could you please help me with the script if possible.

 

Thank you!

1 REPLY 1

Sai Shravan
Mega Sage

Hi @Abhilasha_123 ,

 

In the system properties we have the property name with "instance_name" which gives the instance name. Here is the system property URL(sys_id)  from PDI - https://<instance_name>.service-now.com/sys_properties.do?sys_id=5a381ff1e8a9211076da10591ad28758

 

Below is the background script for reference.

 

var instancename = gs.getProperty('instance_name');
gs.print(instancename);

 

Please mark this as helpful and correct answer, if this helps you

Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you