Record Producer - Auto populating

Jai2021
Tera Contributor

Hi all 
Greetings!
I have  a requirement that need to create an incident record from record producer. In incident form I need populate location field of the caller ,but I didn't have any column in the record producer for location. Location field of an user is stored in different table.I'm writing script, but it's not working.

current.location = producer.caller_id.location.name;

Appreciate your help!

Thanks,
Abirami 

 

 

4 REPLIES 4

Community Alums
Not applicable

Hi @Abirami Thirumoorthi ,

You need to change reference of the field to location table and then set default value to javascript:gs.getUser().getLocation().

Refer this.

Also,https://community.servicenow.com/community?id=community_question&sys_id=16de9f94dbcb8d102454e6be1396...

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

 

I don't have location field in record producer..

YRK
Tera Contributor

Hi Abhi,

you can use below code in the record producer

 

current.location = gs.getUser().getLocation();

 

Please mark it helpful if it answers your question

Thanks,

Ram

Bhavana Reddy
Mega Guru

Use something like below in the script

 

current.location= producer.caller_id.location.getDisplayValue();