
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 11:46 AM
Need to auto populate application business unit which is a reference field referring (cmdb_ci_business_app) depending on the business application field which is also a reference field also referring to (cmdb_ci_business_app) table on a catalog form.
Variable 1: Business Application (Reference - cmdb_ci_business_app)
variable 2: Application business unit(reference-cmdb_ci_business_app)
tried the autopopulate option on the variable it is populating on form level but on ritm its clearing the value.
written a script include and onchange client script also
able to get the value from script include but not able to set on the field . Its setting the value and clearing immediately
please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2024 06:45 PM
@Community Alums
For this case you can use 2nd variable as string type and populate the Business unit via onChange client script
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 05:42 PM
It sounds like both the auto-populate feature and client script/script include are probably working, but being overridden by a Catalog UI Policy or another Catalog Client Script when variable 2 changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 06:46 PM
@Community Alums
why both variabes are referring to same table?
your 2nd variable should be string and set the value using onChange client script + GlideAjax
Also you mentioned it's clearing on RITM level
Please share your script here along with screenshot. your script should be set with Applies on Catalog form checkbox as true
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 01:54 AM
function onChange(control, oldValue, newValue, isLoading) {
Script Include:
With the above script its setting the value on catalog form view i.e., ess view and clearing immediately.
Could you Please guide on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 04:46 AM
If 'application_business_unit' is a reference type variable, just return the business_unit (sys_id), not the display value as a sys_id is what is needed to populate a reference variable or field.
return gr.business_unit;