If i use the getReference in client script it is not working as expected please find the Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 07:19 PM
Hi,
If i use the getReference in client script it is not working as expected please find the Script.
here if i select configuration item then location of the configuration item should be populate in the assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 08:33 PM
Hi @kranthi2,
You can populate a fields available on referenced table and it should be same referenced table on your current form.
According to your scripts, You are going to populate CI Location [cmn_location] value into Assignment group [sys_user_group]. It won't be possible.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 09:05 PM
var ciRef = g_form.getReference('cmdb_ci', setLocation);
function setLocation(ciRef) {
if (ciRef && ciRef.location) {
g_form.setValue('assignment_group', ciRef.location);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 09:52 PM
it seems your logic is wrong.
you are populating location of that CI to group field.
Please select correct field from CI record which holds group information
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader