<?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>Setting properties using results from dialog</title><link>https://www.aras.com/community/f/development/6089/setting-properties-using-results-from-dialog</link><description>I&amp;#39;m having problems updating an item property using a method that opens a custom dialog. I opened a dialog following the ArasModules.dialog example from https://community.aras.com/b/english/posts/tech-tip-opening-a-custom-dialog-from-a-method , the dialog</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Setting properties using results from dialog</title><link>https://www.aras.com/community/thread/3060?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 13:50:56 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:2011f658-29bf-4959-9312-acd28e74cbe1</guid><dc:creator>RickP</dc:creator><description>&lt;p&gt;I&amp;#39;m on v11 SP12 so maybe it&amp;#39;s different, the window is being called like this:&lt;/p&gt;
&lt;p&gt;var topWnd = top.aras.getMostTopWindowWithAras();&lt;br /&gt;var wnd = topWnd ? topWnd : window;&lt;br /&gt;wnd.ArasModules.Dialog.show(&amp;#39;iframe&amp;#39;, param).promise.then(callback);&lt;/p&gt;
&lt;p&gt;Thanks for the help anyways!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting properties using results from dialog</title><link>https://www.aras.com/community/thread/3059?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 13:45:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:bddf354c-2cbe-4c05-88c1-03d97ccae2e4</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hi Rick,&lt;/p&gt;
&lt;p&gt;You can take advantage of another function of the&amp;nbsp;&lt;strong&gt;aras&lt;/strong&gt; object to refresh the grid. You can call&amp;nbsp;&lt;strong&gt;aras.uiReShowItem(item_id, item_id);&lt;/strong&gt; in order to refresh the parent item. Since you said that the&amp;nbsp;&lt;strong&gt;this&lt;/strong&gt; variable seems to be referencing the parent item in the callback, you might be able to accomplish this refresh like so:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;aras.uiReShowItem(this.getAttribute(&amp;quot;id&amp;quot;), this.getAttribute(&amp;quot;id&amp;quot;));&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Note that this will depend on what the actual value of&amp;nbsp;&lt;strong&gt;this&lt;/strong&gt; is.&lt;/p&gt;
&lt;p&gt;In regards to your question about referencing the&amp;nbsp;&lt;strong&gt;self&lt;/strong&gt; variable, I was able to reference this variable just by calling&amp;nbsp;&lt;strong&gt;self&lt;/strong&gt; inside of the callback. This was a test I ran in 11.0 SP15 using the &lt;em&gt;ArasModules.Dialog.show&amp;nbsp;&lt;/em&gt;function. This variable reference might be different if you are using another version of Aras Innovator or a different function for opening your dialog.&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting properties using results from dialog</title><link>https://www.aras.com/community/thread/3057?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 08:20:21 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c2ce548a-5783-4365-9664-e8f54e4c84e1</guid><dc:creator>RickP</dc:creator><description>&lt;p&gt;It actually seems to be working now! I just didn&amp;#39;t realize since the relationship grid didn&amp;#39;t update to show it until&amp;nbsp;I did an empty search, I guess I just need to figure out how to make the method run an empty search as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting properties using results from dialog</title><link>https://www.aras.com/community/thread/3054?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 06:30:11 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d1fd3a78-2db4-4fa7-ad4b-e6b8bc107858</guid><dc:creator>RickP</dc:creator><description>&lt;p&gt;How do I bring the &amp;quot;self&amp;quot; variable back after the dialog returns? When i set a debugger statement in the callback function and check what variables I have, I can&amp;#39;t find the variables from before the dialog was called. My action and method are acting on a relationship item, and it seems like the context after the dialog is the parent item of the relationship instead of the relationship item which is the context before the dialog is opened.&lt;/p&gt;
&lt;p&gt;I had some success with aras.IomInnovator, I used:&lt;/p&gt;
&lt;p&gt;function callback(res) {&lt;br /&gt;&amp;nbsp;if (res) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sel_id = res[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var rel_id = res[1];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var inn = aras.IomInnovator;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var rel_item = inn.getItemById(&amp;quot;RelationshipItemtype&amp;quot;,rel_id);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sel_item = inn.getItemById(&amp;quot;RelatedItemtype&amp;quot;,sel_id);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rel_item.setProperty(&amp;quot;related_item_property&amp;quot;,sel_item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rel_item.apply();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;I can see that rel_item and sel_item are successfully defined in the debugging mode, but the property isn&amp;#39;t being updated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting properties using results from dialog</title><link>https://www.aras.com/community/thread/3038?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2019 14:06:03 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4ff533cc-0bca-4333-96a1-b4fac2cddcd6</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can temporarily store the value of&amp;nbsp;&lt;strong&gt;this&lt;/strong&gt; inside of another variable before you open your dialog. This should allow you to access it inside of your callback after the dialog returns.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;// Store the value of the context item&lt;br /&gt;var self = this;&lt;br /&gt;wnd.ArasModules.Dialog.show(&amp;#39;iframe&amp;#39;, param).promise.then(callback);&lt;/p&gt;
&lt;p&gt;After this, you can access the context item in your callback through the variable you&amp;#39;ve defined instead of&amp;nbsp;&lt;strong&gt;this&lt;/strong&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;span&gt;function callback(res) {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;if (res) {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var id_1 = res[0];&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&amp;nbsp;id_2 = res[1];&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; &amp;nbsp; self.setProperty(&amp;quot;MyProperty&amp;quot;, id_1);&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;self.apply();&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As an additional note, you almost never need to define a new Innovator object inside of a Method. From a client-side method, you can access an Innovator object from most contexts by using&amp;nbsp;&lt;strong&gt;aras.IomInnovator&lt;/strong&gt;. This admittedly shouldn&amp;#39;t have any impact on functionality, but it&amp;#39;s slightly more memory efficient to reference the existing object.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Chris&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Christopher Gillis&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Aras Labs Software Engineer&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>