i have to map the nominated person in excel with subject person in hr case.

Burra Mounika
Tera Contributor

I have to map the nominated person in excel with subject person(sn_hr_core_case_benefits)table in hr case.I need to get the user id(email-id)  of the subject person from the back end table i.e.,(sys_user.do) table.For that i need to write source script in Field map.How can i write that?

 

9 REPLIES 9

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Burra Mounika 

Greetings!

try below script

var userRecord = new GlideRecord('sys_user');
userRecord.addQuery('email', source.email_id); //add source email here
userRecord.query();
if(userRecord.next()){
var userID= userRecord.getUserID();
}

Please hit the thumb and Mark as correct if it helped!

 

Kind Regards,

Ravi Chandra

Burra Mounika
Tera Contributor

Hi Ravi Chandra,

BurraMounika_0-1691153669410.png

this is the page where i need to write source script in filed map form,there it mentioned as return" ";//return the value to be put in to the target field.as you can see attached image.what i need to return there??

 

what is the source field value for email.

var userRecord = new GlideRecord('sys_user');
userRecord.addQuery('email', source.email_id); //what is the source field value for email. I gave email_id
userRecord.query();
if(userRecord.next()){
var userID= userRecord.getUserID();
}

retun  userID

Please hit the thumb and Mark as correct if it helped!

 

Kind Regards,

Ravi Chandra

 

Burra Mounika
Tera Contributor

we are gliding sys_user table ryt?in sys_user table User id backend name is user_name.do i need to mention that in this line??userRecord.addQuery('email', source.email_id)--

in the place of email_id?