efficient ways to look for scripts with hard-coded sys_ids?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2018 09:12 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2018 09:22 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2018 09:32 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2018 10:19 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2018 10:24 PM
Thanks Paul - I will give it a go and learn to determine what sys_ids needed to go away or store somewhere else.