I need the have the Cost Center Code show up in the list view of the Department table.

Jon M3
Tera Expert

I need the have the Cost Center Code show up in the list view of the Department table.  I have created  a custom field on the department table to keep this data. I need help with a BR to keep the two in sync if it changes on the Cost Center table.  Two departments could use the same code.

1 ACCEPTED SOLUTION

Ok, then configure below script in business rule on cost center table to update cost center custom field on department table

Make sure to update correct custom center cost center field name in this script.

var dep = new GlideRecord('cmn_department');
dep.addQuery('u_cost_center',current.sys_id);
dep.query();
while(dep.next()){

dep.u_cost_center = current.sys_id;
dep.update();

}

 

Regards,

Sachin

View solution in original post

9 REPLIES 9

sachin_namjoshi
Kilo Patron
Kilo Patron

You don't need to write BR for this requirement.

You can configure flow on cost center table using flow designer to sync data and update record in department table.

 

 

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/flow-designer/reference/update-record-flow-designer.html

 

Regards,

sachin

I tried that but it is just entering the code in the first record in the Department table - what am I missing?

find_real_file.png

You need to use for each flow logic in your flow to find out all departments with same cost center code and then update department records.

 

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/flow-designer/concept...

 

Regards,

Sachin

I appreciate the direction but I am not real familiar with Flow Designer