Autopopulate field with assigned_to.manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 02:07 AM
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:
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2024 02:57 AM - edited 01-23-2024 03:11 AM
Hello @Sahar_Kaizer -
You can achieve this by using Business rule:
Here's an example using a Business Rule:
- Navigate to "Business Rules" in the Application Navigator.
- 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
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 11:44 PM
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