The CreatorCon Call for Content is officially open! Get started here.

How do I assign manager to a user?

Akki1
Tera Contributor

Hi All,

I have a table which is similar to user table. Let's name it as u_accounts.

It has some fields

user_id

first_name

last_name

Manager

Manager Identity-(Reference to itself i.e u_accounts) - Hidden on form

Manager user Id -String-hidden on form

Now Manager is function field where using Manager identity I am getting its name and user_id and appending them and displaying it on form.

The records are imported from an excel sheet which contains 

user_id,first_name,last_name,manager_user_id . Now after records are imported I want to lookup in the same table for records and search using manager_user_id and assign that in Manager Identity.

We cannot use after business rule as suppose a manager record is after the user records in that case it won't find the manager and it will not work.

How can I implement this any suggestions?

I want it to work even when data is coming from integration or import 

 

 

 

6 REPLIES 6

GodOfWar
Mega Guru

I'd use a Scheduled job to check the new users it daily then assign those empty manager fields.

Uday Damaraju
Tera Contributor

Hi,

 

Please use background script (use the logic specified in your post to assign a manager for each record imported) post importing the data successfully into your custom accounts table.

I trust you might have evaluated before creating custom table to accommodate user related data. Ideally, it is not recommended to create a copy to sys_user table. Suggest you to re-assess the situation and create, or follow business smart customizations recommended by ServiceNow to arrive at informed decisions. 

 

Best Wishes, Uday Damaraju