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

Vamsi Sreenivas
Giga Guru

Hi Betty, what is the value you want to populate in Company when you load the request form?

Hi, I want to  populate in company's name field in variable 'company'

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

Yes ,I want to base on logged in user automatically populate 'company' variable, where should I write this script?

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

Is it a catalog client script?