Autopopulate logged in user's email

Community Alums
Not applicable

Hi,

I am trying to autopopulate the logged in user's email using business rule. It's not working. Kindly help.

 

1.png

 

2.png

 

3.png

 

(function executeRule(current, previous /*null when async*/ ) {

	current.email = gs.getUser().email;

})(current, previous);

 

Regards

Suman P.

13 REPLIES 13

Hi @Community Alums   

FYI - This worked for me as well when i selected caller it autopopulated its email .

 

 

Kindly mark it correct and helpful if it is applicable.

Thanks,

Raj

raj chavan
Tera Guru

You can use this approach Autopopulate email filed based on caller using GlideAjax

 

 

Kindly mark it correct and helpful if it is applicable.

Thanks,

Raj

Community Alums
Not applicable

Hi @raj chavan,

 

I can definitely use GlideAJAX. I am learning Business Rules.

 

Regards

Suman P.

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