How to populate cost center value based on logged in user company detail

rin1
Kilo Guru

Hi all,

I have created a field 'cost center' for a catalog item and referenced the values from the cost center table  (cmn_cost_center). We have got many customers, so I have added a new reference field 'company' to the cost center table (cmn_cost_center). And referenced cost center table to the above mentioned field. I need to use this variable in multiple catalog items, so i added this to a variable set.

Requirement is, based on the logged in user company, the cost center data should be populated. I have tried multiple reference qualifiers and finally used "javascript: "cost_centre="+gs.getUser().getCompany();" but it doesnt work. Can anyone help me on this.

Thanks,

Rini

 

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

You would need to use the appropriate field name on the referenced table that has companies referenced to that...

So:

javascript:"name_of_company_field_on_cost_center_table="+gs.getUser().getCompanyID();

Please verify the name of the company field you're using on the cost center table and also please note the correct method used for the GlideSystem API to get the company ID of the user.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

2 REPLIES 2

Allen Andreas
Administrator
Administrator

Hello,

You would need to use the appropriate field name on the referenced table that has companies referenced to that...

So:

javascript:"name_of_company_field_on_cost_center_table="+gs.getUser().getCompanyID();

Please verify the name of the company field you're using on the cost center table and also please note the correct method used for the GlideSystem API to get the company ID of the user.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

Thank you for your reply. I have updated the reference qualifier based on your comments, unfortunately it dint work.

I have added the company name under the reference qualifier condition, and it worked.

 

Thanks,

Rini