Need to have a display value different from the one set on the table

marperezgon
Tera Contributor

Need to have a way to show a different display value from the cmn_department table, currently the display value (dictionary table column display:TRUE) is "Name". I know how to set this on a Variable where it will show whatever other column I want it to show. BUT how can I do the same on a form?

I've added a new reference field on the Demand form referencing the cmn_department table, but I need it to show a different column (ie. Business unit, currently displaying the Name). I cant use dictionary overwrite since this is a new field on the form (not coming from a parent). And I dont want to change the whole system just for this form. how could I get this done?

5 REPLIES 5

Sabrina Ethridg
Tera Guru

If you want to display the business unit, could you make the reference field to the Business unit (business_unit) table instead?

The business unit was just as an example, I'm looking more into displaying such as "code" or maybe "ID", any ideas will be appreciated!

SD_Chandan
Kilo Sage

Hi @marperezgon ,

use client script on load


(function executeRule(current, previous) {
    var deptField = gForm.getReference('your_reference_field_name', function(ref) {
        if (ref) {
            var displayValue = ref.u_business_unit || ref.name; // fallback to name
            gForm.setDisplayValue('your_reference_field_name', displayValue);
        }
    });
})();

 

 

Thank you
Chandan

SD_Chandan
Kilo Sage

use client script on load


(function executeRule(current, previous) {
    var deptField = gForm.getReference('your_reference_field_name', function(ref) {
        if (ref) {
            var displayValue = ref.u_business_unit || ref.name; // fallback to name
            gForm.setDisplayValue('your_reference_field_name', displayValue);
        }
    });
})();

 

 

Thank you
Chandan