How to populate department field with data from 2 possible locations.

Dai Llewellyn
Tera Contributor

Hi all,

 

I have a requirement from a customer to populate the department field on the user record based on the information given in either a custom field or the manager field.

 

The field that is chosen is based on whether the custom field is empty or not.

 

Scenario 1 - the custom field contains data.

 

In this scenario they would like to use the value from the custom field (Cost Center ID) and cross reference that with the ID field on the cmn_department table. If there is a match then the name of the matching ID should be populated into the department field on the user record.

 

Scenario 2 - Cost Center ID field is empty

 

If the Cost Center ID field is empty, the customer has requested that the users manager be looked up and the department from that record should be used to populate the empty field on the original users record.

 

Scenario 3 - Cost Center ID and Manager fields are empty

 

If this is true then the customer wants nothing to happen.

 

Can anyone suggest a best way to achieve this? I expect it will require a script of some kind but am not 100% on how to approach it.

 

Thanks in advance for any help.

1 REPLY 1

luffy3478
Tera Guru

Straight forward scripting in the order you have mentioned the scenarios