In Reference field default value not setting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 01:24 AM
Hi All,
I have one requirement:
1)One Test (u_test) table I have created below is the field
Field Name - type - Default Value
1)Domain - Domain ID - global
As per this is setting global as default value it will be showing as like reference field when we search in that field it will be showing Group(sys_user_group) list(names).
but I have no idea why Domain ID type is showing like as Reference to Group table.
2) In catalog item I have created a variable set In that variable set below field
Field Name - Type - Default Value
1)Domain - Reference Group(sys_user_group) - global
Note: global is not a group Name
when I set in catalog item field: Domain as default value global , I'm not getting exact result.
Please find the attached documents for your reference please let me know how can I set field as like table field in catalog item.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 01:28 AM
Based on your requirement, it seems like you are trying to set a default value for a reference field in a catalog item. Here are the steps you can follow:
1. Create a new table 'u_test' with the following field:
- Field Name: Domain
- Type: Domain ID
- Default Value: global
2. Note that the Domain ID field type is a special type of reference field that points to the Domain table. It's not a reference to the Group (sys_user_group) table. If it's showing Group names, it might be due to some customization or misconfiguration.
3. For the catalog item, you have created a variable set with a field:
- Field Name: Domain
- Type: Reference to Group (sys_user_group)
- Default Value: global
4. The 'global' value you are trying to set as default is not a group name, hence it's not working as expected. You need to set a valid group name as the default value.
5. If you want to set the field in the catalog item like the table field, you need to make sure both fields are of the same type and pointing to the same table.
6. If you want to set a default value for a reference field in a catalog item, you can use a 'Default value' field in the variable set. The value should be a valid sys_id from the referenced table.
7. If you want to set the default value dynamically, you can use a catalog client script with the 'onLoad' function to set the default value.
Please note that the 'global' value is not a valid group name or sys_id, so it won't work as a default value for a reference field. You need to use a valid sys_id or group name from the Group (sys_user_group) table.
For ServiceNow Live Classes, Books, Sample Resumes, Interview Questions, CSA Quizzes.
And getting better services's on ServiceNow you can visits our website.
Please visit : https://nowkb.com/home
Our Website :https://nowkb.com/home
nowKB.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 02:21 AM
Hi@Ramesh Lohar ,
As per the 6 step in variable set default value we can not set default value to variable set. Please can you show to me .
As per the 7 step please can you provide the catalog client script as per this requirement.
Please help me regarding this.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 02:34 AM
Hi@Ramesh Lohar ,
As per the 7 th step, I have written the onload client script. If we set the value which is already in the group table then it will working. If global is not group name when we set it will not working as expected
Please find the attached document for more information.