- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2017 01:58 PM
As shown in the figure of a catalog item, I have a reference field named 'Disk Name' and when a value is selected the field 'Current Disk Size' should be populated
I have the written the following script, but the pop up box is not closing once I select the value of the reference field and is giving me error 'getReference for disk_name not allowed: missing callback function as parameter'. I am not sure how to make a callback function and pass it as a parameter. If that is needed then in what part of the script I should add it.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var disk_name = g_form.getReference('disk_name');
var disk_size;
var disk_rec = new GlideRecord('x_aona_gcp_gcp_persistent_disks');
disk_rec.addQuery('sys_id',disk_name);
disk_rec.query();
while(disk_rec.next()){
//gs.info('inside while');
disk_size=disk_rec.disk_space;
}
g_form.setValue('c_disk_size',disk_size);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 01:26 PM
Yes, it is a scopped app. But the issue was that we are querying on a record, which is wrong. The getReference method return us a complete record, so we just had to point to the right attribute.
The code here is as shown below.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var disk_name = g_form.getReference('disk_name',fillRec);
}
function fillRec(response){
var size = response.disk_space;
g_form.setValue('c_disk_size',size);
}
And this will solve the issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 07:09 AM
So it runs the function "fillRec" and the var id has the sys_id in it but after that it stops working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 07:17 AM
Yes, exactly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 07:23 AM
Sounds like a permissions issue maybe. Does the client side give a script error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 07:25 AM
What permissions should I set/change. No client script is not giving me any error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 07:29 AM
At this point I would verify the user making the call has access to the table.
I would also verify that when you go to the table directly and query for the sys_id that is being return that you get the record you are expecting. Maybe its not returning what you think it is.