Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Fetch active user details based on the job role from RITM and display it under related list as a tab

Hemamani Prabha
Tera Contributor

Hello all, 

 

I have a requirement as such:

On a catalog item MRP Task, show a related list tab named 'Users'
That tab must show the Active Users on the Job Role that the task refers to with the columns User, User ID, Active

 

I've created a new record in "System definition -- > Relationships" as Users and now how do I fetch the active user details based on the job role from the RITM. Please help me with the query.

I've queried the req item table and fetched the job role name , how to proceed further? 

 

Thanks,

Hema

5 REPLIES 5

AnilNemmikanti_0-1708441866832.png

Here we can see the current object and parent. we can leverage these and build the query. Here RITM is parent table so u can parent.variables.variable_name(job role) to get the job role.

 

Query would be:

 

current.addQuery(job_role_field, parent.variables.job_role_variav=ble);

current.addQuery('active',true);

Please try in this way.

If my answer is correct please mark it as helpful.