- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2016 08:29 AM
Hello All -
I am working on a project that starts with a record producer. On the producer, I have variables for Name and Company. Both fields are of type Reference to sys_users. I want to pre-populate both when the producer loads - name with the Name of the currently logged in user and Company with the company entry off the Company field in the users table.
So far, I have the Name field populated correctly by using javascript:gs.getUserID(); as the default value.
My question is with Company. I've got javascript:gs.getUser().getCompanyID().getDisplayValue(); in as the default value but nothing is displayed.
Before it is suggested, yes, I do have something in the Company field for the account I am testing with.
I would appreciate any thoughts on this issue.
Thank you!
Chris
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2016 08:45 AM
Chris,
As santosh suggested, change the referencing table from sys_user to core_company, and you need to set the default value to sys_id of the company not the display value.Put this "javascript:gs.getUser().getCompanyID()" in the default value and you are good to go.
Thanks,
Abhinay
Please mark Helpful, Like, or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 12:25 AM
Hi Chris,
We are having the same requirement, We are using core_company as reference table. and we put javascript:gs.getUser().getCompanyID() this script in default value. still it is not showing any thing for contacts.
We have record producer for customers. so onload customers company name should populate in that fields.
When we used single line text field and default value as "javascript:gs.getUser().getCompanyID()" then is is showing sys_id we tried getDisplayValue() still it is not showing anything.
Can you please guide us, I would appreciate any thoughts on this..
Thank You!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2017 01:43 PM
javascript:gs.getUser().getCompanyRecord().name;