Filtering cost center on the current user's company

kim-lindgren
Kilo Sage

Hi all,

 

I have a list collector that needs to filter the Cost center table on the current user's company. I want to do this in a reference qualifier if possible.

 

javascript:"u_company=" + gs.getUserID().getValue('company');

 

 

The above returns no results at all (and I know the current user has a company).

 

I have tried a number of similar things, none of which return a value (or in one case it returns records with company = none).

 

Edit: I thought it might be a syntax error and changed to:

u_company=javascript: gs.getUserID().getValue('company');

No change, though it may have something to do with the syntax.

 

Many thanks.

1 ACCEPTED SOLUTION

kim-lindgren
Kilo Sage

@Anand Kumar P 

 

I removed getUniqueValue and your code worked perfectly:

javascript: 'u_company=' + gs.getUser().getCompanyID();

 

Do you need to enter getUniqueValue when you make such a query? Curious, in that case.

 

I wonder why getValue('company') did not work in this case.

 

Anyway, thanks a lot, I have to mark my own post as solution but you have been very helpful!

 

/Kim

View solution in original post

3 REPLIES 3

Anand Kumar P
Giga Patron
Giga Patron

Hi @kim-lindgren ,

getCompanyID()Returns the company sys_id of the currently logged-in user.var companyID = gs.getUser().getCompanyID();

Try this script

 

 

javascript: 'u_company=' + gs.getUser().getCompanyID().getUniqueValue();

 

 

Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand

Yes getUniqueValue() not required i forgot to remove.In above mentioned table i removed that but forgot in script.

Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand

kim-lindgren
Kilo Sage

@Anand Kumar P 

 

I removed getUniqueValue and your code worked perfectly:

javascript: 'u_company=' + gs.getUser().getCompanyID();

 

Do you need to enter getUniqueValue when you make such a query? Curious, in that case.

 

I wonder why getValue('company') did not work in this case.

 

Anyway, thanks a lot, I have to mark my own post as solution but you have been very helpful!

 

/Kim