logged in user should be set to caller field

Anusha M2
Kilo Contributor

logged in user should be set to caller field

4 REPLIES 4

Kalyani Jangam1
Mega Sage
Mega Sage

Hi Anusha,

At the dictionary level of caller field set the default value as javascript: gs.getUserID()

Ankur Bawiskar
Tera Patron
Tera Patron

@Anusha M 

Hi,

there can be 3 ways in which this can be done

You can decide which approach to take

1) Dictionary default value

javascript: gs.getUserID();

OR

2) On load client script on that table

function onLoad(){
	
	if(g_form.isNewRecord()){
		g_form.setValue('caller_id', g_user.userID);
	}
	
}

OR

3) Display business rule on that table

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

	// Add your code here
	if(current.isNewRecord())
		current.caller_id = gs.getUserID();

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

PY_GV
Tera Contributor

thanks, this worked!