Populating Company Field On Record Producer

chriscorbett
Giga Contributor

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

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

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


View solution in original post

6 REPLIES 6

santoshsahoonis
Kilo Guru

You should change the reference for the company field to core_company.


Abhinay Erra
Giga Sage

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


Looks that that did it... Many thanks to you both!


how about only company name?