How to autopopulate caller field with the current login user details using client script ?

Sharath Goud2
Kilo Explorer

How to autopopulate caller field with the current login user details using client script ?

7 REPLIES 7

SumanthDosapati
Mega Sage
Mega Sage

Hi Sharath,

 

No need to write client script to auto populate caller with current logged in user.

Open that field in dictionary level and in default value write the below line

javascript: gs.getUserID()

 

If you still want to go with client script then write below:

function onLoad() {
	
	var userID = g_user.userID;
	
	if (g_form.getValue('caller_id') == '')  //check caller id field name
		g_form.setValue('caller_id', userID);
	
}

 

Mark as correct and helpful if it solved your query.

Regards,

Sumanth

@Sharath Goud 

Feel free to post if your have further queries or you can mark an answer as correct and helpful to close the thread.

How can I make this work for the now mobile app?  I inserted this into the dictionary field on the incident level and it works in the console.  But it does not work for creating an incident in the now mobile app.

but it should happen only for new records