<?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>Adding a CUI button, getting context item</title><link>https://www.aras.com/community/f/development/37645/adding-a-cui-button-getting-context-item</link><description>Hi aras team, 
 I am adding a cui button to the command bar, but random question... 
 How can I get the context item for my method? The usual ways don&amp;#39;t seem to apply and I am getting an error: 
 &amp;quot;identifier &amp;#39;options&amp;#39; has already been declared&amp;quot; 
 the</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8895?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 12:56:27 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f8d4deb2-9388-45a2-9a40-e15dade11b45</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;If your are a subscriber, the CUI Admin Guide contains&amp;nbsp;a few (~3?) tiny code samples that covers finding the context item.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And some of the technical foundations are described in the patent Aras uses for CUI:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://uspto.report/patent/app/20200394055"&gt;https://uspto.report/patent/app/20200394055&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(Some of the pictures show a few nice to know details, but in general the patent is no&amp;nbsp;big help. &amp;nbsp;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8890?ContentTypeID=1</link><pubDate>Wed, 19 Oct 2022 06:39:39 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:11fae89e-0164-469f-89b3-0625c3798194</guid><dc:creator>alaxala</dc:creator><description>&lt;p&gt;I have long come to terms with the fact that there is no good documentation and never will be. The only support for the community is the debugger and sources.&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t know anything about &amp;quot;options&amp;quot; three days ago. All I did was add a CUI button, an&amp;nbsp;&amp;quot;Item Click&amp;quot; method with one line:&lt;/p&gt;
&lt;p&gt;debugger;&lt;/p&gt;
&lt;p&gt;turned on developer tools in the browser and pressed the my button.&lt;/p&gt;
&lt;p&gt;And voila, now I see the whole context of my &amp;quot;Item Click&amp;quot; method with its parameters, their properties, properties and methods of the &amp;quot;window&amp;quot;, &amp;quot;document&amp;quot; etc. And now I know about &amp;quot;options&amp;quot;.&lt;/p&gt;
&lt;p&gt;Unfortunately this is the only way to do something beyond the documentation examples.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8885?ContentTypeID=1</link><pubDate>Tue, 18 Oct 2022 16:45:57 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:de8c4c50-703d-44c4-b16f-c9cbbe7e7fdd</guid><dc:creator>Morgan</dc:creator><description>&lt;p&gt;I&amp;#39;ll keep this in mind. I got my solution working but I have a feeling these other projects will come in handy very soon &lt;span class="emoticon" data-url="https://www.aras.com/community/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: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8884?ContentTypeID=1</link><pubDate>Tue, 18 Oct 2022 16:15:02 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:2628f5ae-c5d5-4e23-99a6-4a392de7c7e0</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;There are a couple of Aras community projects on github regarding&amp;nbsp;CUI elements that are very helpful. Just search for &amp;quot;aras cui github&amp;quot;.&lt;/p&gt;
&lt;p&gt;They cover the most important stuff you need to know. But some of them may be outdated.&lt;/p&gt;
&lt;p&gt;More fancy stuff like the &amp;quot;init Methods&amp;quot; you have to find out on your own.&lt;/p&gt;
&lt;p&gt;Some general&amp;nbsp;tip as soon as you want to build more intelligent&amp;nbsp;buttons&lt;/p&gt;
&lt;p&gt;1. Know the names most important&amp;nbsp;CUI locations (depends on version cause Aras did some restructuring once, which was great fun)&lt;br /&gt;2. Try to understand how Aras names the CUI Methods.&lt;br /&gt;3. Try to understand the Promote/MassPromote button (it contains a lot of little UI highlights)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8883?ContentTypeID=1</link><pubDate>Tue, 18 Oct 2022 16:00:19 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:044db6c4-b098-4227-aa8c-2624d86c4f58</guid><dc:creator>Morgan</dc:creator><description>&lt;p&gt;Thanks for this info, is there any documentation on CUI out there? The admin guide is pretty abysmal. I feel like I may run into more situations like this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8882?ContentTypeID=1</link><pubDate>Tue, 18 Oct 2022 13:46:08 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:08f9ac3f-fb54-4b34-a1d4-1cef745d138d</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;This discussion reminds me to this post where I tried to figure out to call a Method from everywhere:&amp;nbsp;&lt;a href="/f/development/3996/call-same-client-method-from-different-locations-action-cui-form-button"&gt;https://community.aras.com/f/development/3996/call-same-client-method-from-different-locations-action-cui-form-button&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The post shows&amp;nbsp;a combined CUI call mentioned that works for Grid and Form. But it&amp;acute;s maybe not the best variant anymore. Using &amp;quot;options&amp;quot; as outlined by Alaxala is probably the more modern approach.&lt;/p&gt;
&lt;p&gt;&amp;quot;options&amp;quot; is a hidden variable used by the CUI element. As Alaxala says, it contains the itemId - or even multiple ones when we came from a grid and user selected 10 items at once. So it&amp;acute;s most of the time the most flexible variant if you reuse the Method at many locations.&lt;/p&gt;
&lt;p&gt;If you just use the CUI element in a Form, you can get the full context similiar to document.thisItem like this:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;const myItem = thisItem;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;const myId = thisItem.getId();&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a CUI button, getting context item</title><link>https://www.aras.com/community/thread/8873?ContentTypeID=1</link><pubDate>Mon, 17 Oct 2022 07:36:48 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:107f3247-995f-4b70-9550-39f6e4966978</guid><dc:creator>alaxala</dc:creator><description>&lt;p&gt;&amp;quot;options&amp;quot; is declared as the parameter of your onClick method and has the &amp;quot;itemId&amp;quot; and &amp;quot;itemTypeName&amp;quot; properties. Or you can use window.item.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>