How to populate logged user name in reference field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 10:12 AM
Hi,
In incident form we have field called caller_id. The person who logged in their name should auto populate in the caller_id field. Once he removed the name then in the list it should show the logged in user name first followed by the list of user based on alphabetical order. How we can achieve this. Could anyone help me on this.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 10:20 AM
Hi @Arun91 ,
You can do this by setting the default value of the field from dictonary to > javascript:gs.getUserID()
and to show the users in alphabatical order :
use attribue > ref_ac_order_by=name
i hope this helps...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 10:50 PM
If we click on x mark in the reference field, then it should display the logged in username first followed by the list of users from sys_user table. How we can achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 05:09 AM
Hi,
You can create an OnLoad Client script on the incident form with the below code:
var userID = g_user.userID;
g_form.setValue('caller_id', userID);
This will set the value of the caller_id field with the currently logged in user.
Thanks,
Manik Modi
If you find this helpful, please mark this reply as the solution. Thanks!
