Populate the cost centre code into a different field based on selected cost centre

matthew_hughes
Kilo Sage

I've created a new field called 'Cost Centre Code' on one of my catalogue items:

find_real_file.png

What I want to do with this field is populate the 'code' from the cost centre (cmn_cost_center) table depending on what's selected in the 'Cost centre'

 

So far, I've written a catalogue client script but it doesn't seem to do anything:

find_real_file.png

 

If somebody could please let me know what I need to do, that would be much appreciated.

 

3 REPLIES 3

Sajilal
Mega Sage

Could you try putting alerts and confirm where its failing or not returning any result. Also why cost center code field looks read only? maybe try making the field not read only.

Please mark helpful/correct if you are ok!

Thanks,
Saji

asifnoor
Kilo Patron

Hi,

Canyou also share the SI that you have written. Also check what values are you getting in the result.

suvro
Mega Sage
Mega Sage

You should write a OnChange Client script on change of cost center rather than onLoad. Then it will work. When you pass values to Script include variable should be sysparm_table and sysparm_sys_id

Variable should start with sysparm_