Show User According To Role

Hi Guys, Anyone has Idea how to display users according to role or security group in the relate/dropdown filed. if I have Role1 then, I want to show all the users of Role1 in the dropdown.

Have a look at solutions in these forums mentioning SQS

that is the name of the system that manages the find-as-you-type searches in the relate fields.

Hi pgr, Thanks for the reply. But these solutions didn’t help me. What I need, I have multiple roles i.e. CSR, Marketer, Manager, Team Head, Accountant, Producer, and each role contains multiple users. I have Account module, when I’m creating a new account then I want to show dropdown/relate field of CSR, Marketer, Manager, and these dropdowns contain the list of the users according to their role. And then I can assign the account to these Users( CSR, Marketer, Manager). Please give me any idea or hint.

Is this the kind of selection you’re trying to change?

Changing the query that filters the pop-up windows where you select related records
suitecrm.com/suitecrm/forum/developer-help/27499-popupdefs-static-enforced-criteria

Thanks pgr, Its quite helping for me.

array (
          0 =>
          array (
            'name' =>'csr_c',
            'studio' =>  'visible',
            'label' =>  'LBL_CSR',		
			  'displayParams' => 
         array (
           'initial_filter' => '&id_advanced=742a7f4c-681b-e558-9858-5e29a48b0a9e',	  
        ),		
          ),
          1 => '',
        ),

I have role_id for CSR in acl_roles_users table from their I can get user_id then I might be able to perform joining operation in users modules. Then I think i can get id of user for ‘initial_filter’ . If I use entrypoint then how my entrypoint will run automatically.? I don’t want to run scheduler/conejob. Is there is another way to get dynamically userid for 'initial_filter' => '&id_advanced=$id',

I have written custom query and successfully getting multiple ID of Users but its worked for only single ID.
Can any have an idea of how I can pass multiple values in ‘initial_filter’.

 array (
           'initial_filter' => '&id_advanced='.$id,      // Its worked for single Id but I have multiple Id.
        ),

Maybe this?

https://www.w3schools.com/sql/sql_in.asp

sorry, bro but it didn’t help me. I have multiple Id in $id variable and its look like

$id=Array ( [0] => 1 [1] => 20a50570-ef71-17e2-a804-5e2e839434a0 [2] => 736a9f9a-3684-b2d1-cfc2-5e29a5fe89cc [3] => 742a7f4c-681b-e558-9858-5e29a48b0a9e);
My question is I want to pass this $id in initial_filter

‘displayParams’ =>
array (
‘initial_filter’ => ‘&id_advanced=’.$id,
),

It’s working fine if I have single id i.e.$id= 20a50570-ef71-17e2-a804-5e2e839434a0; but it is not working for multiple Id. Please help me.

Eso es ya una cuestion de PHP… puedes utilizar

implode(",", $array);

para ponerlo dentro del parentesis del SELECT… IN()

Hi pgr, Can you please tell me how I can put IN condition in

‘initial_filter’ => ‘&id_advanced=’.$id,

Any advice will be greatly appreciated!

Ahah I don’t know why I answered in spanish in my earlier post… :confused: :rofl:

I was looking at this as if it was an SQL clause to be added to the WHERE… but it isn’t. It’s just a list of fields that is appended to the URL.

So I think this won’t work - not possible, sorry.