Autopopulate field with assigned_to.manager

Sahar_Kaizer
Tera Contributor

Hi,

I created a u_team_leader field on support feedback form I created and I need it to have a default value of assigned_to.manager.

I tried this:

 

Sahar_Kaizer_0-1706004354019.png

 

javascript:var userManager; var user = new GlideRecord('sys_user');
if (assigned_to.get(gs.getUserID())) 
{userManager = user.manager}; userManager;

 

But it doesnt work.

I would appritiate any help.

Thanks, 

Sahar

2 REPLIES 2

Pratiksha2
Mega Sage

Hello @Sahar_Kaizer -

You can achieve this by using Business rule:

Here's an example using a Business Rule:

  1. Navigate to "Business Rules" in the Application Navigator.
  2. Create a new Business Rule with the following settings:
    • Table: Choose the appropriate table (e.g., incident).
    • When to run: Before
    • Insert: true
    • Update: false
  3. Add the script:

 

  var callerUser = new GlideRecord('sys_user');
        if (callerUser.get(current.assigned_to)) {
            current.u_team_leader = callerUser.manager;
        }

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

Thanks,

Pratiksha



Pratiksha2
Mega Sage

Hello @Sahar_Kaizer -

I wanted to check in regarding the response I provided. If my suggestions were beneficial in addressing your query or helped in resolving your issue, would you mind marking it as helpful, accepting the solution, and closing the thread? Your acknowledgment not only shows appreciation for the assistance but also assists future readers who might come across a similar problem.

Thank you for your consideration!

Best regards,
Pratiksha