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  

gs.getUser().getCompanyID

aikotoba
Tera Guru

I used gs.getUser.getCompanyID() to get the sys_id of a company.

For some reason, the same value is output even if I change the Company field in the user record.

Why is this? Please help.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@aikotoba 

If you have used the above in the default value then it would only work for 1 time when new form is opened

It would auto-populate the logged in user's company

Please try to logout and login again and test once

Regards
Ankur

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

View solution in original post

3 REPLIES 3

Santosh_Ksagar
Mega Sage

Hi,

Please find below thread for your reference:-

https://community.servicenow.com/community?id=community_question&sys_id=7714cfe5dbd8dbc01dcaf3231f96...

Thanks
Santosh

 

Ankur Bawiskar
Tera Patron
Tera Patron

@aikotoba 

If you have used the above in the default value then it would only work for 1 time when new form is opened

It would auto-populate the logged in user's company

Please try to logout and login again and test once

Regards
Ankur

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

Hi Ankur

I was able to solve the problem, thank you.