
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 10:24 AM
Greetings Folks
Another scripting question (Ah! the hits just keep on coming don't they?)
So I am building Catalog Item forms for specific requests. In this case a User Access Request. The challenge is I need to script it so that the form auto-populates the Assignment Group based on the CI chosen. The assignment group will be the same as The CI assignment group in the CMDB.
I just don't know the language to do this, or whether it should be a catalog client script or some other variant.
Any help will be most appreciated!
Cheers
A.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 12:04 PM
You shouldn't need to modify the group variable, but I did just realize my script has a scope issue. It should look like this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ciVar = 'configuration_item';
var ci = g_form.getReference(ciVar, getGroupCallback)
}
function getGroupCallback(ci) {
var asgVar = 'assignment_group';
g_form.setValue(asgVar, ci.assignment_group);
}
Also, the variable name on the catalog client script record should be configuration_item rather than assignment group. You're telling it which field to monitor for changes, which should be the CI field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 10:32 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 10:33 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 10:33 AM
I would use an onChange catalog client script that runs against your CI variable. It would look something like:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ciVar = 'name_of_ci_variable';
var agVar = 'name_of_assignment_group_variable';
var ci = g_form.getReference(ciVar, getGroupCallback)
}
function getGroupCallback(ci) {
g_form.setValue(agVar, ci.assignment_group);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2018 11:57 AM
Hi Brad!
Thanks for this. I'm trying it now, I've set the script up like this:
But I realize I have to modify the Assignment Group reference field as well... somehow.
I had it referencing the Group [sys_user_group] table and the ref qualifier was 'Simple' with the Name is not empty filter so that a list would be provided when the field was clicked. I had Help Desk set as the default.
I was wondering how I should modify the Assignment Group field to take input from the script?
Cheers
A.