How to add two or more sys_id in system property?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2021 09:17 AM
I'm trying to add multiple sys_id in a single system property.
- Labels:
-
Delegated Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 12:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 02:33 AM
hello,
You can use something like this
var groupSysIds = gs.getProperty('property_name');
var gr= new GlideRecord('sys_user_grmember');
gr.addQuery('group', 'IN', groupSysIds);
gr.addQuery('user', gs.getUserID());
gr.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 10:09 PM - edited ‎10-09-2024 10:10 PM
hi Saurav11,
I need to add different groups sys id in system property and add them to a business rule. only if that group member is making the changes on the particular table and my below code should run . somewhere its not running properly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 10:20 PM
In ServiceNow, if you want to add multiple sys_id
values to a system property, you typically store them as a comma-separated string or use a specific format that your application logic can parse. Here's how you can do it:
-
Navigate to System Properties:
- Go to System Properties > All Properties in your ServiceNow instance.
-
Create or Edit a Property:
- Either create a new property by clicking New or edit an existing property by selecting it from the list.
-
Set the Value:
- In the value field, enter the
sys_id
values separated by commas. For example:sys_id1,sys_id2,sys_id3
- In the value field, enter the
-
Save the Property:
- Click on Submit or Update to save your changes.
-
Accessing the Property in Code:
- When you access this property in scripts, you can split the string into an array for processing. For e
var sysIds = gs.getProperty('your.property.name').split(',');
- When you access this property in scripts, you can split the string into an array for processing. For e
-
Handling Special Cases:
- Ensure that any logic you implement can handle cases where the property might be empty or where the sys_ids might not be valid.