Set a field value based on two other fields

jimcalhoun
Kilo Expert

I have a field called "CostCenter" and it is based on the value in the "CARSDept" field and the "DeskCode" field.   I have created a second table with all three fields in it that contain all the possible values as a lookup.   I need to find the matching CostCenter value based on the other two fields that are in my import file when i do an insert.   Can someone help me with the script.  

8 REPLIES 8

I will give it my best try in the morning, I am watching OU beat up on TCU.


Berny,   I have a screen shot below:   The "DeskCode" and the "Billing Dept" are provided in my import file and I need to lookup the Cost center.   I have 150 combinations of these 3 values (see second screen shot).   your assumption that they filter down is not correct.   I think I need a business rull.



find_real_file.png


find_real_file.png


Hi Jim,



This seems similar to how an incident's priority depends on the impact and urgency. See if a using a data lookup definition works for you. It can apply only for record inserts if you want.


Kamil26
Giga Contributor

Hi,

 

You can create two Client Scripts, both are onChange() type. One is depend on CostCenter and second is depend on DeskCode.

Both codes are this same

Example below

function onChange() {
   //Type appropriate comment here, and begin script below
   var dept = g_form.getValue('CostCenter');
    var base = g_form.getValue('DeskCode');
    
    if (base == 'DUB'){
        
        if(dept == 'Engineering'){
            
            g_form.setValue('costcenter','ABE89');    
        }