<?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>How to get username on the basis of customField1?</title><link>https://community.appian.com/discussions/f/data/12042/how-to-get-username-on-the-basis-of-customfield1</link><description>Hello All, 
 I have requirement to fetch user name on the basis of customField1. How can I achieve this? Thanks in advance</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to get username on the basis of customField1?</title><link>https://community.appian.com/thread/53314?ContentTypeID=1</link><pubDate>Tue, 13 Mar 2018 09:46:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:33c6ab58-7da7-4e31-9385-4118af9c905f</guid><dc:creator>viveku3486</dc:creator><description>Hey Brad,&lt;br /&gt;
&lt;br /&gt;
Thank you so much. Your rule worked perfectly for me.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get username on the basis of customField1?</title><link>https://community.appian.com/thread/53297?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 19:25:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:61ce9e16-994f-491f-949a-af7233d79204</guid><dc:creator>bradc</dc:creator><description>I realized there is also a plug-in titled &amp;quot;Get Users By&amp;quot; which contains a function fn!getusersby which allows you to search for users by specific fields in a user profile that will accomplish what you&amp;#39;re looking for with far less code.  I would recommend using this plug-in if you are able to install plug-ins.  &lt;br /&gt;
&lt;br /&gt;
Here is a snippet of the code that would be required to retrieve users with a customField1 value of &amp;quot;Test&amp;quot; using this plug-in:&lt;br /&gt;
&lt;br /&gt;
fn!getusersby(&lt;br /&gt;
  recordValue: &amp;quot;Test&amp;quot;,&lt;br /&gt;
  recordType: 6,&lt;br /&gt;
  operator: &amp;quot;1&amp;quot;&lt;br /&gt;
)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get username on the basis of customField1?</title><link>https://community.appian.com/thread/53296?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 19:10:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b5c8d34e-62f1-4a3b-aacb-bda02aa89a32</guid><dc:creator>bradc</dc:creator><description>Hi,&lt;br /&gt;
&lt;br /&gt;
Below is the code I used to create such a rule.&lt;br /&gt;
&lt;br /&gt;
This rule uses one input &amp;quot;customField1&amp;quot; (Text) and a constant containing a group with all users.  You can use this rule to pass in the customField1 value you are searching for to return an array of users. &lt;br /&gt;
&lt;br /&gt;
with(&lt;br /&gt;
  local!userDictionary: a!forEach(&lt;br /&gt;
    items: getdistinctusers(&lt;br /&gt;
      cons!AllUsers&lt;br /&gt;
    ),&lt;br /&gt;
    expression: {&lt;br /&gt;
      user: fv!item,&lt;br /&gt;
      customField1: user(&lt;br /&gt;
        fv!item,&lt;br /&gt;
        &amp;quot;customField1&amp;quot;&lt;br /&gt;
      )&lt;br /&gt;
    }&lt;br /&gt;
  ),&lt;br /&gt;
  index(&lt;br /&gt;
    local!userDictionary,&lt;br /&gt;
    &amp;quot;user&amp;quot;,&lt;br /&gt;
    wherecontains(&lt;br /&gt;
      ri!customField1,&lt;br /&gt;
      touniformstring(&lt;br /&gt;
        local!userDictionary.customField1&lt;br /&gt;
      )&lt;br /&gt;
    ),&lt;br /&gt;
    null&lt;br /&gt;
  )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
I hope this is useful.&lt;br /&gt;
Brad&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>