Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

efficient ways to look for scripts with hard-coded sys_ids?

georgechen
Kilo Guru

Hi folks,

I am in a process of analysing a requirement in one of my org's performance optimisation process, one requirement was to replace hard-coded sys_id with sys_property records, and the script will need to perform gs.getProperty('non-hard-coded-sys_property_name') to retrieve the unique sys_id value, 


I am going through every single business rule on task at 1st stage, but wondering if anyone has gone through this with a more efficient approach. 

 

Any advice would be appreciated. 


Thanks,

George

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

Hello,

 

please run below to find code with hardcoded sys_id

 

https://snprotips.com/blog/sncprotips/2015/12/locate-any-record-in-any-table-by-sysidhtml

 

Regards,

Sachin

Thanks Sachin for helping!   Despite this forum tip does not direct output scripts that meet the hard-coded sys_id conditions, it is worthwhile to learn the concepts!  I'll have a go and make adjustments if we do need to go ahead with the analysis.

Cheers,
George

 

The SN Nerd
Giga Sage
Giga Sage

You can use a RegEx pattern for something like this:

/[a-f0-9]{32}/g

Keep in mind though - not every sys_id is best placed to be in System Properties.
Consider other alternative such as Templates or data driven solutions.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Thanks Paul  - I will give it a go and learn to determine what sys_ids needed to go away or store somewhere else.