How to use "name" instead of "display name" for a reference field in one specific table only

beycos
Tera Contributor

Hello, 

The reference field shows the Display Name from table X, as expected, since the Display Name field has Display = true. Without changing this setting, is it possible to use the Name field for the reference field, but only in one specific table?

Thank you and Regards, 

Beyza

 

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@beycos 

whatever field is marked with Display=True it will show that value once reference value is selected

Without touching the Display=True at dictionary you can't control what's seen there.

If my response helped please mark it correct and close the thread so that it benefits future readers.

View solution in original post

Dr Atul - LNG
Tera Patron

Hi @beycos 

It’s not possible unless the 'Display Name' is set to True. This behavior is by design and is the standard out-of-the-box functionality."

View solution in original post

5 REPLIES 5

Hello again Atul, 

 

Currently, in the CMDB table, the "Display Name" field is set to Display = true, and it shows the value in the format (name - company name). However, in table X, I want to use only the name field (not the full display name) in a reference field.

I'm trying to find an alternative solution for this.

I created a new string field and I'm attempting to use a Client Script to populate it with only the part of the reference field's display value up to the first dash (-).
After that, I plan to hide the reference field.

I wrote the following script, but it's not working yet.

 

function onLoad() {
    g_form.getReference('u_business_product_or_service_name', function(ref) {
        if (ref) {
            var displayValue = ref.getDisplayValue();
            if (displayValue) {
                var shortValue = displayValue.split('-')[0].trim();
                g_form.setValue('u_short', shortValue); // Show only the part before dash
            }
        }
});
}

Could I get your opinion or suggestions on this?

Thank you 

Beyza