<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/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>Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/f/development/55331/prefill-simple-search-criteria-in-the-search-grid</link><description>Hello, 
 For Documents item type, in the search grid I need the &amp;quot;Classification&amp;quot; to be prefilled to &amp;quot;General&amp;quot; . 
 
 I applied client side method to &amp;quot;classification&amp;quot; and &amp;quot;search_default&amp;quot; properties of Documents but it doesn&amp;#39;t work. 
 &amp;quot;search_default&amp;quot; property</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10608?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2024 11:53:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:ce77fc31-a25c-4af8-8edf-f190976705e2</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;To be honest, I don&amp;acute;t thing the onBeforeGet filter is the best solution for your use case at all. I still think MAC and DAC are maybe the better option or just some Saved Searches.&amp;nbsp;Don&amp;acute;t believe everything you find in this forum&amp;nbsp;&lt;span class="emoticon" data-url="https://www.aras.com/community/cfs-file/__key/system/emoji/1f601.svg" title="Grin"&gt;&amp;#x1f601;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Main question: Do you want to have a restriction out of convenience or for security?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What you see now is the beauty of all onBeforeGet solutions - the tiny little happy details.&lt;/p&gt;
&lt;p&gt;First you have to ensure that your own identity&amp;nbsp;does not contain the target identity too. If you don&amp;acute;t want to exclude your self from the identity group, write another code to abort the method for admins or similar groups.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To ensure you can still open the items from a relationship while they are hidden in the main grid, you need a trick.&lt;/p&gt;
&lt;p&gt;Basically you allow people to open the item, if they explicitly search for it (this is what happens in the relationships automatically)&lt;/p&gt;
&lt;p&gt;You need to add something like this to your current solution:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if (this.getProperty(&amp;quot;id&amp;quot;,&amp;quot;&amp;quot;) == &amp;quot;&amp;quot;)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp;this.setProperty(&amp;quot;classification&amp;quot;,&amp;quot; Shipping Unit&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But as mentioned before, it&amp;acute;s maybe not the best solution for you use case. In doubt ask Aras!&amp;nbsp;They get these kind of questions very often. I assume have a subscription. Why not use it?&lt;/p&gt;
&lt;p&gt;And tell Aras they need to find a better open release option that ensures the survival of the supportive forum community. Thanks :).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10604?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 17:48:45 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c3c89075-e8c7-4a0c-9e51-8dc567bbe136</guid><dc:creator>Hargul Sidhu</dc:creator><description>&lt;p&gt;&lt;a href="/community/members/angela"&gt;AngelaIp&lt;/a&gt;&amp;nbsp;I applied this method to onBeforeGet. Correct results show in the Document search grid however other Documents, the ones that have Classification other than General do not open. They show but don&amp;#39;t open.&amp;nbsp;&lt;br /&gt;As you can see in the screenshot Document PR-100001 does not show in the search result which is the intended outcome. However, it doesn&amp;#39;t open. It would open if the method is not applied to the Document item.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Method:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Innovator inn = this.getInnovator();&lt;br /&gt;//Id of Identity ShopFloor&lt;br /&gt;string target = &amp;quot;6AEA9BA311D64CD080005608BAF10914&amp;quot;;&lt;br /&gt;string currentUserIds = Aras.Server.Security.Permissions.Current.IdentitiesList;&lt;br /&gt;if(CCO.Permissions.IdentityListHasId(currentUserIds, target))&lt;br /&gt;{&lt;br /&gt; // Add additional filter if user has targetId identity included in it&amp;acute;s id list&lt;br /&gt; this.setProperty(&amp;quot;classification&amp;quot;,&amp;quot;General&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;return this;&lt;br /&gt;&lt;br /&gt;Screenshot:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/Snipaste_5F00_2024_2D00_10_2D00_22_5F00_10_2D00_47_2D00_06.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10591?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2024 11:33:09 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:e03d877d-3412-4dc0-a562-0d6b9b9d62b4</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;This one will lead to an error --&amp;gt; string identity = inn.newResult(relatedId);&lt;br /&gt;&amp;quot;newResult&amp;quot; is an item, not a string.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Second error is caused by the missing return. You only return something in this if statement. But nothing if the &amp;quot;if-statement&amp;quot; is bypassed.&lt;br /&gt;&lt;br /&gt;Which event type do you use right now?&lt;/p&gt;
&lt;p&gt;As said before, avoid unnecessary queries at all cost cause &amp;quot;get&amp;quot; Methods are executed for every search operation which can lead to performance problems.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Something like this could work for onBeforeGet (not tested):&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;string currentUserIds = Aras.Server.Security.Permissions.Current.IdentitiesList;&lt;br /&gt;if(CCO.Permissions.IdentityListHasId(currentUserIds, targetId))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp;// Add additional filter if user has targetId identity included in it&amp;acute;s id list&lt;br /&gt;&amp;nbsp; this.setProperty(&amp;quot;classification&amp;quot;,&amp;quot;General&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;return this;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;onBeforeGet Methods influence the search filter. It&amp;acute;s not a classic item operation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10582?ContentTypeID=1</link><pubDate>Wed, 02 Oct 2024 22:31:59 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:0e807a0d-b94b-4eaf-a946-36d8d8f05aca</guid><dc:creator>Hargul Sidhu</dc:creator><description>&lt;p&gt;thanks &lt;a href="/community/members/angela"&gt;AngelaIp&lt;/a&gt;&amp;nbsp; following your post above i have this method&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;nnovator inn = this.getInnovator();

//Get ID of the logged in user
Item alias = inn.newItem(&amp;quot;Alias&amp;quot;,&amp;quot;get&amp;quot;);
alias.setProperty(&amp;quot;source_id&amp;quot;,inn.getUserID());
alias.setAttribute(&amp;quot;select&amp;quot;,&amp;quot;related_id&amp;quot;);
alias = alias.apply();


//Get id of the identity the user is part of
string relatedId = alias.getProperty(&amp;quot;related_id&amp;quot;);
string identity = inn.newResult(relatedId);


// ID of the identity &amp;quot;ShopFloor&amp;quot;
string target = &amp;quot;DBA5D86402BF43D5976854B8B48FCDD1&amp;quot;;

//Get the filtered object if the logged in user&amp;#39;s related identity matched the Id of &amp;quot;shopFloor&amp;quot; identity
if(identity == target){
//Get Item document where &amp;quot;classification&amp;quot; = &amp;quot;General&amp;quot;
Item docs = inn.newItem(&amp;quot;Document&amp;quot;,&amp;quot;get&amp;quot;);
docs.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;&amp;quot;);
docs.setProperty(&amp;quot;classification&amp;quot;, &amp;quot;General&amp;quot;);
return docs.apply();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the errors i get is&amp;nbsp;&lt;br /&gt;ERROR: 9FB01F83F326460EA304FBB7FA24AC2A.&lt;br /&gt;Line number 13, Error Number: CS0029, Cannot implicitly convert type &amp;#39;Aras.IOM.Item&amp;#39; to &amp;#39;string&amp;#39;&lt;br /&gt;Line number -3, Error Number: CS0161, &amp;#39;ItemMethod.methodCode()&amp;#39;: not all code paths return a value&lt;br /&gt;&lt;br /&gt;I can get the related ID by adding the line &amp;quot;return inn.newResult(relatedId)&amp;quot; but this stops the further execution of the code block. If I run the part that gets me the filtered &amp;quot;Document&amp;quot; item ,separately, where Classification = General that works too. However, when I combine the two code blocks that get me the related_id of the UserId and filtered Document item I get the above error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10576?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2024 09:56:24 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:e6dfa0d0-a898-4aea-81ef-988dcec09c1f</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;I edited the original post, but unfortunately page auto translate of my browser kicked in. I don&amp;acute;t have the original post anymore. Just translate from German to English, it still should make sense somehow :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10575?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2024 09:48:07 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d570204e-a031-4631-bb7d-ea8c31470a55</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;Ah, okay! Du willst einen dynamischen Filter. Es gibt noch ein paar andere Optionen.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;1. Der Benutzer kann seine eigene gespeicherte Suche angeben. Dies ist eine gute L&amp;ouml;sung, wenn der Filter nur aus praktischen Gr&amp;uuml;nden verwendet werden soll.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;2. Mit einem &amp;bdquo;On Before Get&amp;ldquo;-Serverereignis k&amp;ouml;nnen Sie zus&amp;auml;tzliche Suchbedingungen hinzuf&amp;uuml;gen.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;this.setProperty(&amp;quot;Klassifizierung&amp;quot;,&amp;quot;mycat&amp;quot;); &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;gib dies zur&amp;uuml;ck;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;Nachteil der L&amp;ouml;sung: Der Benutzer kann nicht sehen, dass ein Filter aktiv ist. Normalerweise verwendet man diese Technik f&amp;uuml;r &amp;bdquo;orderBy&amp;ldquo;-Einstellungen oder andere Filterverbesserungen, die f&amp;uuml;r den Endbenutzer von geringem Interesse sind.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;Sie k&amp;ouml;nnen eine Identit&amp;auml;tspr&amp;uuml;fung hinzuf&amp;uuml;gen, aber versuchen Sie, unn&amp;ouml;tige Abfragen so weit wie m&amp;ouml;glich zu vermeiden. Der Code wird von jedem einzelnen Benutzer f&amp;uuml;r jede Grid-Operation ausgel&amp;ouml;st ... immer!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;3. Sie k&amp;ouml;nnen die Einstellungen f&amp;uuml;r die Benutzer vordefinieren, um die Suchbedingung immer einzuschlie&amp;szlig;en.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;In meiner Umgebung hatten wir tats&amp;auml;chlich den umgekehrten Anwendungsfall. Aufgrund einiger versehentlich gespeicherter Einstellungen war eine bestimmte Suchbedingung immer vorhanden und der Benutzer musste sie immer manuell l&amp;ouml;schen.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;Benutzer k&amp;ouml;nnen die Pr&amp;auml;ferenz immer noch selbst l&amp;ouml;schen (in Wirklichkeit tun sie das nie &amp;ndash; sie fragen immer zuerst den Administrator). Ich habe hierf&amp;uuml;r keine gebrauchsfertige Anleitung. Sehen Sie sich den Pr&amp;auml;ferenzelementtyp an und versuchen Sie zu verstehen, was passiert. Sie k&amp;ouml;nnen die Pr&amp;auml;ferenz f&amp;uuml;r bestimmte Identit&amp;auml;ten per Methode &amp;auml;ndern.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;EDIT: User save their own preference settings with the &amp;quot;Save layout&amp;quot; button. Maybe this is the best solution for you if you don&amp;acute;t mind that people can overwrite the filter.&lt;/p&gt;
&lt;p&gt;&lt;span style="vertical-align:inherit;"&gt;&lt;span style="vertical-align:inherit;"&gt;4. Wenn Sie aus Sicherheitsgr&amp;uuml;nden einen Filter ben&amp;ouml;tigen, versuchen Sie es mit MAC/DAC.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10574?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2024 16:36:53 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:87bbf29f-5f66-42d7-a6e0-9bfca158b54c</guid><dc:creator>Hargul Sidhu</dc:creator><description>&lt;p&gt;&lt;a href="/community/members/angela"&gt;AngelaIp&lt;/a&gt;&amp;nbsp; oh right &amp;quot;Default Search&amp;quot; option works. I was hoping to do this via a method. Because we need this &amp;quot;Default Search&amp;quot; to be populated for a certain identity only.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Prefill simple search criteria in the search grid</title><link>https://www.aras.com/community/thread/10570?ContentTypeID=1</link><pubDate>Thu, 26 Sep 2024 15:43:14 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:a700f034-b9d8-4267-98dc-451da8031fe6</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;using the &amp;quot;Default Search&amp;quot; column for the classification property in your ItemType should work just fine. The filter Methods are typically used for pop-up search dialogs.&lt;/p&gt;
&lt;p&gt;You just need to keep in mind that this feature is a bit of a diva. &amp;quot;Default Search&amp;quot; loves to conflict with user preferences. Have you tried the &amp;quot;Reset preferences&amp;quot; button in the user menu in the top right corner?&lt;/p&gt;
&lt;p&gt;Angela&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>