This is a public Forum  publicRSS

Topic

    John L
    Filtering Based on Logged In Account GroupAnswered
    Topic posted October 11, 2017 by John LApprentice 
    39 Views, 3 Comments
    Title:
    Filtering Based on Logged In Account Group
    Content:

    Is it possible to filter rows in a report based on the signed in accounts assigned group? My first thought was to use a custom script to get the logged in user id and query the account table to obtain the group_id for the logged in user. I would then be able to hide all the rows containing a certain value. However there does not seem to be away to get the account id of the user viewing the report in the custom script. Any suggestions/tips on how I may accomplish this? 

    Version:
    May 2016

    Best Answer

    Suresh Thirukoti

    To get Account logged in ID, you can use the below code in Custom scripts of reports

    initialization tab

    require_once(get_cfg_var('doc_root')."/ConnectPHP/Connect_init.php");
    initConnectAPI();

    Process tab
    $res = RightNow\Connect\v1_2\ROQL::query( "SELECT  curAdminUser();" )->next();

    while ($result = $res->next())
    {
    $rows[0][2]->val = $result['curAdminUser()'];
    }

    http://communities.rightnow.com/posts/784d075067

    ~Suresh

    Answer

     

    • Suresh Thirukoti

      To get Account logged in ID, you can use the below code in Custom scripts of reports

      initialization tab

      require_once(get_cfg_var('doc_root')."/ConnectPHP/Connect_init.php");
      initConnectAPI();

      Process tab
      $res = RightNow\Connect\v1_2\ROQL::query( "SELECT  curAdminUser();" )->next();

      while ($result = $res->next())
      {
      $rows[0][2]->val = $result['curAdminUser()'];
      }

      http://communities.rightnow.com/posts/784d075067

      ~Suresh

    • Carl Elliott

      That is a standard option in the filters on the incident table.  You can filter on incidents.assgn_group_id and there is a logged in option.  

       

      group.jpg (23KB)
    • John L

      I should've mention in my initial post that I am dealing with all custom objects here. Suresh's solution worked perfectly for getting the logged in account's ID which I used in a subsequent ROQL query to get the logged in users group. I then was able to unset records based on this. Thank you for both of your replies!