How to make record producer automatically populate field when user load the request form in service portal?

Betty9
Tera Contributor

I have a record producer variable 'company' which mapping to incident table 'company' , I want to make this variable automatically populate 'company' variable when user load the request form in service portal. How to do it?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

based on logged in user?

if yes then you can use default value in that variable; I assume that variable is of type reference

javascript: gs.getUser().getCompanyID();

Regards
Ankur

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

View solution in original post

18 REPLIES 18

Hi,

in the default value of that variable

Are you in scoped app?

Regards
Ankur

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

Hi @Betty ,

Any update on this?

Regards
Ankur

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

Viknesh Pannirs
Tera Expert

Please see the below community question that helps.

https://community.servicenow.com/community?id=community_question&sys_id=3684763bdbb6bf445ed4a851ca96195d

 

Mohith Devatte
Tera Sage
Tera Sage

hello @Betty ,

you can do one thing open the company variable in your record producer and in the default value section you can find a input box to enter the default value like below

javascript:gs.getUser().getCompanyID()

find_real_file.png

Please mark my answer correct if it helps you

 

 

Hi, I writed this script, but it still no respose,why?

find_real_file.png