Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populating caller location using default value

Community Alums
Not applicable

Hi All,

I want to populate the incident caller's location on location field using the default value.
I tried with javascript:gs.getcaller_id().getRecord().getDisplayValue("location");  but it is not working.
Can you please help how can I achieve this ?

Note: Location field created on task table.

27 REPLIES 27

Community Alums
Not applicable

but this will give the current logged in user location right ,

I want caller's location

@asmita sahu No it will give the caller id location 

just replace it to below 

when you use current.caller_id then you can dot walk to any field on user table to access just like i did for location

javascript:current.caller_id.location

mark my answer correct if it helps you

Community Alums
Not applicable

but it is not working , it is not populating the location

If you are looking to populate location upon selection of caller_id, then use onChange client script on caller field.

var caller = g_form.getReference("caller_id", getCaller);

function getCaller(caller){
    g_form.setValue("location", caller.location);
}
Best Regards
Aman Kumar

Community Alums
Not applicable

ya I can use client script but the requirement is to set from default value only