Autopopulate logged in user's email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 12:39 AM
Hi,
I am trying to autopopulate the logged in user's email using business rule. It's not working. Kindly help.
(function executeRule(current, previous /*null when async*/ ) {
current.email = gs.getUser().email;
})(current, previous);
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 01:59 AM - edited 12-10-2024 01:59 AM
Hi @Community Alums
FYI - This worked for me as well when i selected caller it autopopulated its email .
Thanks,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 01:35 AM
You can use this approach Autopopulate email filed based on caller using GlideAjax
Thanks,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 01:49 AM - edited 12-10-2024 01:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 02:02 AM - edited 12-10-2024 02:02 AM
Hi @Community Alums ,
As the email field is on sys_user table we are dotwalking from caller_id field.
Create display business rule--with below script
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.userEmail = gs.getUser().getEmail();
})(current, previous);
Create onload client script on incident table with below script
function onLoad() {
if(g_scratchpad.userEmail){
g_form.setValue('caller_id.email',g_scratchpad.userEmail);
}
}
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand