Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

get current user company in service catalog

Abhinab Achary1
Tera Guru

Hi All,

I have a service catalog. now in a reference field pointing to core_company table. I want to populate current user's company   name ...

I need a suggestion on this

Regards

Abhinab

1 ACCEPTED SOLUTION

Swapnil Bhakar1
Mega Guru

Hi Abhinab,



Put this "javascript:gs.getUser().getCompanyID()" in the default value of your field where you want to populate current users company name.



Hope it will help you.



Regards,


Swapnil



PS: Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

5 REPLIES 5

shaikbasha
Kilo Expert

Getting a User Object - ServiceNow Wiki



Check the above link.



Thank you.


michal29
Mega Guru

Hello Ahbinab,



I would put this into default value:


myUserObject.getCompanyID() -- returns the sys_id of the current user's company


More on this topic: Getting a User Object - ServiceNow Wiki



Alternatively, you can create onChange client script and query sys_user table to find the current user, and fill his company



Regards,


Michal


Swapnil Bhakar1
Mega Guru

Hi Abhinab,



Put this "javascript:gs.getUser().getCompanyID()" in the default value of your field where you want to populate current users company name.



Hope it will help you.



Regards,


Swapnil



PS: Hit like, Helpful or Correct depending on the impact of the response


thia will only retruen sys_id