<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>need to users direct groups</title><link>https://community.appian.com/discussions/f/general/21621/need-to-users-direct-groups</link><description>Team, 
 We have list of users in array , we want to know there direct group names which they belongs too. 
 Regards, 
 Gaurav</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: need to users direct groups</title><link>https://community.appian.com/thread/84546?ContentTypeID=1</link><pubDate>Thu, 12 Aug 2021 17:47:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30ba8ce9-753b-4766-a66b-947ea00a0502</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I couldn&amp;#39;t think of any direct way and I am not aware of a plug-in also (other community members might help) for this but I have found a workaround.&amp;nbsp;&lt;br /&gt;Attaching a code snippet below.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!user: loggedInUser(),
  local!userGroups: getgroupsformemberuser(local!user),
  local!booleanFlags: a!forEach(
    items: local!userGroups,
    expression: contains(
      touniformstring(a!groupMembers(
        group: fv!item,
        direct: true,
        memberType: &amp;quot;USER&amp;quot;
      ).data),
      tostring(local!user)
    )
  ),
  index(
    local!userGroups,
    wherecontains(
      true,
      local!booleanFlags
    ),
    null
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It will give you all the direct groups of the passed user.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Harshit Bumb&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>