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

hello @Betty ,

i hope this is a reference type field?

can you confirm on this ?

Also make sure there are no spaces before javascript and after companyID()

 

Incident company field is a reference type and my variable is also a reference tpye and already mapped to Incident company field 

find_real_file.png

@Betty  then can you check in user profile of the logged in user if the company field is empty .

If yes try to give some company and save the user record and try 

I checked user profile of the logged in user, the company field is empty, Then I selected a company, it still not working. any solutions?

What type of variable is 'Company' in record producer?

If the record producer variable is also reference field and referring to 'Company' table then you can use this in default value

javascript:gs.getUser().getCompanyID()

 

Regards,
Sumanth