Variable value is displaying the sys id

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 11:25 AM
I have a catalog item in which the user selects a drive (from a reference) and then I have a script to pull back the owner of the drive but it is giving the sys id vs the value. This information is on the cmdb table. I know that I should be able to make the display = true for one of those fields on the table, but because it is the storage file share there are securities which is locked and don't allow me to change the display.
I was told that I could use the getDispaly value, but I am not sure how to do this. I have a catalog client script where I am pulling back the current owner (see below). Not sure where to add this getDisplay value.
function onChange (control, oldValue, newValue, isLoading) {
if (newValue == '') {
g_form.setValue("current_owner", "");
return;
}
var cmdb_ci_storage_fileshare = g_form.getReference('variable name',CallBack);
}
function CallBack(cmdb_ci_storage_fileshare) {
g_form.setValue("current_owner", cmdb_ci_storage_fileshare.owned_by); // single line text field
}
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 11:29 AM
function onChange (control, oldValue, newValue, isLoading) {
if (newValue == '') {
g_form.setValue("current_owner", "");
return;
}
var cmdb_ci_storage_fileshare = g_form.getReference('variable name',CallBack);
}
function CallBack(cmdb_ci_storage_fileshare) {
g_form.setValue("current_owner", cmdb_ci_storage_fileshare.owned_by.getDisplayValue()); // single line text field
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 11:41 AM
I added the getDisplayValue()); and now the result is empty
I don't even get the sysid.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 11:29 AM
try changing
g_form.setValue("current_owner", cmdb_ci_storage_fileshare.owned_by);
to
g_form.setValue("current_owner", cmdb_ci_storage_fileshare.owned_by.name);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2018 11:39 AM