<?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>Testing interface that with different &amp;quot;loggedInUsers&amp;quot;</title><link>https://community.appian.com/discussions/f/user-interface/34656/testing-interface-that-with-different-loggedinusers</link><description>My interface hides or shows buttons based on the users role, determined by &amp;quot;loggedInUser()&amp;quot;. I would like to test the interface mocking different logged in users. Is there a way to achieve that?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133329?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 17:56:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f85caa9e-5192-4314-82f2-47cae8446138</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;As Mike notes, you can pass in an override as input, use this value as the user default when present and use loggedinuser() otherwise when empty. (I like the a!defaultValue approach, I do not use that function enough yet &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt; ).&amp;nbsp; All scenarios will involve a local variable for this however (which is good).&lt;/p&gt;
&lt;p&gt;While this will work (and could have some cool uses &lt;em&gt;in lower envs&lt;/em&gt;), I&amp;#39;m not as big of a fan on this approach since it essentially leaves a &amp;#39;&lt;em&gt;testing use only&lt;/em&gt;&amp;#39; logic&amp;nbsp;in production (for best practices, production footprint should be minimal all around).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;just prefer to adjust the code until I&amp;#39;m comfortable and allow UAT to iron these things out essentially.&amp;nbsp; My $.02 &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133328?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 17:10:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a666ce10-fa60-4180-8cb4-c46e842bf966</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="83375" url="~/discussions/f/user-interface/34656/testing-interface-that-with-different-loggedinusers/133326"]however I want to be able to pass in user as logged in User [/quote]
&lt;p&gt;&lt;em&gt;local!currentUser: a!defaultValue(ri!overrideUsername, loggedinuser()),&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133327?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 17:09:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:310bf016-6569-4f13-bdc7-5802b7c7e597</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="2401" url="~/discussions/f/user-interface/34656/testing-interface-that-with-different-loggedinusers/133323"]I always recommend storing the loggedInUser() to a local variable, and using the local variable throughout the interface.&amp;nbsp; [/quote]
&lt;p&gt;This is what I do too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133326?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 16:56:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b013b83f-9c69-4eab-9f7d-95cc8e825686</guid><dc:creator>nancyb0004</dc:creator><description>&lt;p&gt;Thank you Chris - that is what I am doing, however I want to be able to pass in user as logged in User so I can test the interface through different scenarios without having to touch the code itself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133323?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 16:28:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1a63d6e6-2e3e-44b6-b476-1c9d0dc3b96a</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I always recommend storing the loggedInUser() to a local variable, and using the local variable throughout the interface.&amp;nbsp; This way, you can test all interface differences based on the user by temporarily updating the local!user variable in one place:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  /*local!user: loggedInUser(),*/
  local!user: touser(&amp;quot;user.name&amp;quot;),
  
  ...
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Further preferred on my end, by using something such as a constant on each server holding the name of your server, this code is safer by preventing unwanted functionality if you forget to change the commenting back prior to deployment (happens..):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!user: if(
    cons!SERVER_NAME=&amp;quot;DEV&amp;quot;,
    touser(&amp;quot;user.name&amp;quot;),
    loggedInUser()
  ),
  
  ...
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133303?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 15:03:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:72db5c6c-c7ca-4e04-a221-3921eb37fc20</guid><dc:creator>Konduru Chaitanya</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a href="/members/nancyb0004"&gt;nancyb0004&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You would simply have to have a list of usernames in a constant and keep testing it in place of the loggedInUser(). Also you can add/remove yourself in the groups and try it out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Testing interface that with different "loggedInUsers"</title><link>https://community.appian.com/thread/133302?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 15:02:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c27ae268-8fd6-497f-a10b-9f1740e72e4a</guid><dc:creator>Karumuru Abhishek</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/nancyb0004"&gt;nancyb0004&lt;/a&gt;&amp;nbsp;Yes you can do that for buttons you will have showWhen condition, check the loggedInUsser is part that of that group based on that you can display the buttons&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>