Updating values on a catalogue item based on the Business Owner field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In ServiceNow, I've got a requirement on a catalogue item where I need to update the value of to fields based on the value of another field:
For my catalogue item, when a user updates the New Business Owner field, I want the New Business Owning Business Unit of Function and New Business Owning Platform fields to be updated if the New Business Owner's Department doesn't currently align with the current fields on the left handside.
New Business Owning Business Unit of Function can have the department type of 'Function' or 'Business Unit'. This can have children departments with the type of 'Platform'
I've written the below function in my script include:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Take another look at the GlideAjax guide. You're not getting the parameters from the client script correctly, and make sure your Script Include is client callable with the extended object included for starters:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @matthew_hughes ,
One thing i observe is you have assigned field names? not the actual field values.
In a catalog client script, you should always use g_form.getValue() to retrieve values and g_form.setValue() to update them.
var deptId = 'new_business_owner.department';
var currentBU = 'current_business_owning_business_unit_or_function';
var currentPF = 'current_business_owning_platform';
.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@matthew_hughes This looks like an AI generated code to me as following lines used in the client script seems incorrect.
var deptId = 'new_business_owner.department';
var currentBU = 'current_business_owning_business_unit_or_function';
var currentPF = 'current_business_owning_platform';
Also, the script include seems to be a server side script include and doesn't seem to be client callable. As recommended by fellow members. Please go through the GlideAjax and Script include tutorials.
