Variable value is displaying the sys id

Cupcake
Mega Guru

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


}

find_real_file.png

 

Thank you.

 

8 REPLIES 8

instead of

g_form.setValue("current_owner", cmdb_ci_storage_fileshare.owned_by.name);

 

try

 

g_form.setValue("current_owner", cmdb_ci_storage_fileshare.owned_by.user_name);

 

Shane it is pulling back empty now. No errors but nothing either.

Thanks,

Karen

Does the user you're referencing in the owned by field have a user id on their user record?

 

If so try changing

g_form.setValue to g_form.setDisplayValue

Hi Steve - that didn't work either.

And in addition, the customer decided that field was no longer needed.

 

Thank you for your assistance.

Karen