
- 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 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 04:26 PM
Thank you Brad!
I found that one of my variables was misspelled (assigment_group) so nothing was going to happen until I noticed that too.
Works perfectly!
Thank you for the education!
Cheers
A.