Update Related List In Corresponding Record (User / Department)

Wayne Miller
Tera Guru

I have a requirement to update the User Related List in Department (cmn_department) with a value which is set in the User Record and vice versa.

 

1) When I populate the Department (reference to cmn_department) record in the User Form it should update the User Related list in the Department Record (see below Department Reference in User Record):

2024-04-16_11-05-33.png

 When this is populated I would like to update the related list in Department to show this User (see below Department record User Related List):

2024-04-16_11-08-04.png

2) When I edit the related list in Department to add a new user, the Department field on User should populate.  

 

From what I've read so far, I can achieve this with Business Rule(s), but it's difficult to know where to start, do I run the BR on User or Dept table?  Or do one for each?

 

Some example javaScript would be very much appreciated.

1 ACCEPTED SOLUTION

Wayne Miller
Tera Guru

Ok, further to this, it appears the when ServiceNow was integrated, the OOB Field designation for Department was amended.  Which on the surface seems like bad practice (create a new field surely?!)

 

Thank you for all your help.

View solution in original post

3 REPLIES 3

Shivani M S
Kilo Guru

Hi @Wayne Miller ,

 

This is the out of the box behavior in servicenow:

ShivaniMS_0-1713322562075.png

ShivaniMS_1-1713322585070.png

Wayne Miller
Tera Guru

Thanks for replying.  That's great.  However, the department field within sys_user on our instance is configured as a single line text, and not a reference.

 

2024-04-17_09-41-19.png

 

I did create a new "Department" field for user, making it a reference to (cmn_department), but this landed me back at the above.

Wayne Miller
Tera Guru

Ok, further to this, it appears the when ServiceNow was integrated, the OOB Field designation for Department was amended.  Which on the surface seems like bad practice (create a new field surely?!)

 

Thank you for all your help.