Default value for a reference field on UI page

Swetha M
Mega Guru

How to set a particular caller name as default value in Caller field(reference) on an incident form UI page.

25 REPLIES 25

AJ-TechTrek
Giga Sage
Giga Sage

Hi @Swetha M ,

 

No need to change the default value if you only want to return active users, just update the 'Reference Specification' tab and the Reference Qual Condition to ACTIVE is TRUE.



Then if you don't auto-populate the caller field with the current user and need to lookup users, it will only return active-true users, is that your intention?



By default that incidentGetCaller() will autopopulate the caller field if the user logging the incident is not an itil user, otherwise it presumes they are logging a call on behalf of someone so will use the reference qualifier to only show you active users.

 

Or refer the below docuemntattions.

 

https://docs.servicenow.com/en-US/bundle/utah-platform-administration/page/administer/field-administ...

 

Please mark my reply as Helpful and/or Accept Solution, if applicable. Thanks!

 

Thanks

Ajay Kumar

Anurag Tripathi
Mega Patron
Mega Patron

You can use this to set the default value to the currently logged in user :

 

<g:ui_reference name="ref" table="sys_user" value="${gs.getUserID()}" displayvalue="${gs.getUser().getDisplayName()}" />



or if you want to set it to some default value, map the sys id as follows:

 

ui_reference name="ref" table="sys_user" value="<give_sys_id_of_default_value_here>"/>

-Anurag

Hi Anurag,

 

I tried the same but no luck. The caller field is empty. Is there a way I can glide the sys_user table from script include and set the value? 

Hi @Anurag Tripathi ,

 

I did the same and Iam able to populate the caller field with a specific record. However, I dont see the display value of caller name in the field.