How to use user criteria to select users based om specific company field?

Jacob64
Kilo Guru

Dear all,

At his moment we use groups to select users with specific company fields.
For example all users that are working for a company that is considered to be a customer  may use certain Catalog items.
Now we add these companies to a criteria group and all users working for a company that  have customer is true.
However. This changes all the time and it is likely that we miss out companies or allow companies that are no longer considered to be customers.  So beside changing the customer flag we also have to change the user criteria group by removing or adding the company.

What we would like to do is to add for example the customer field (or future new field content) to the user criteria and make the user criteria less difficult to maintain.

Can this be done by adding the specific field to the user criteria form and if so how do we do that?
Or do we need to add a script that gets the field value  and is so what wold be a proper script to do so?
Additional will such a way way of filter out the right users have an impact on performance?

Many thanks in advance!

Kind Regards,
Jacob

6 REPLIES 6

Hi,

I'm going to try this.
But additional, what if we want to give more visibility to the company director.
Would the piece of code be something like:

if (usr.company.u_director == 'user_name') ?

Or am I missing something here?

Many thanks in advance.

Regards
Jacob.

Hi,

 

Not really giving more visibility. That code would create a user criteria that allows access to users that are connected to a company with a certain director. A user criteria is triggered by an action to access something. If the criteria returns true then access is given. With a script you can check for anything but it only makes sense to put it in the context of the user triggering the action. Hence the name, user criteria.

 

Also if the u_director field is a reference then you should use the sys_id of the referenced record for evaluation. 

 

Regards,
Niklas