<?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>How to reference the ItemType in the current tab in a Dialog box?</title><link>https://www.aras.com/community/f/development/5937/how-to-reference-the-itemtype-in-the-current-tab-in-a-dialog-box</link><description>I&amp;#39;m working on a client side method to clone an ItemType using a dialog box. My approach is to make a form with a check box to choose to copy properties and another check box to copy values from a relationship tab, and a button for &amp;quot;Done&amp;quot; and &amp;quot;Cancel</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to reference the ItemType in the current tab in a Dialog box?</title><link>https://www.aras.com/community/thread/2763?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 19:20:45 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:293f29a5-ee33-46fe-b77c-b62c4948100a</guid><dc:creator>dortego</dc:creator><description>&lt;p&gt;I figured this out five minutes after posting it. For me, the context item reference was parent.newItem. So the basic method I made is as follows. It will clone an ItemType in a new tab with the current ItemType&amp;#39;s chosen properties when you close the dialog box.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;var inn = new Innovator();&lt;br /&gt;var newItem = inn.newItem(&amp;quot;ItemTypeName&amp;quot;,&amp;quot;add&amp;quot;);&lt;/p&gt;
&lt;p&gt;var fetchForm = top.aras.getItemByName(&amp;quot;Form&amp;quot;, &amp;quot;CloneFormName&amp;quot;);&lt;br /&gt;var currItem = parent.thisItem;&lt;/p&gt;
&lt;p&gt;// set arguments being passed to dialog&lt;br /&gt;var params = {&lt;br /&gt; title: &amp;#39;Clone Form&amp;#39;, &lt;br /&gt; formId: fetchForm.getAttribute(&amp;quot;id&amp;quot;), // put your form&amp;#39;s id here&lt;br /&gt; aras: top.aras,&lt;br /&gt; isEditMode: true,&lt;br /&gt; dialogWidth: 400, // set width int&lt;br /&gt; dialogHeight: 300, // set height int&lt;br /&gt; content: &amp;#39;ShowFormAsADialog.html&amp;#39;,&lt;br /&gt; item: currItem&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;var callback = function() {&lt;br /&gt; //Perform logic using dialog result here&lt;br /&gt;&lt;span&gt;newItem&lt;/span&gt;.getItemByIndex(0).setProperty(&amp;quot;config_id&amp;quot;, params.item.getProperty(&amp;quot;config_id&amp;quot;)); &lt;br /&gt;&lt;span&gt;newItem&lt;/span&gt;.getItemByIndex(0).setProperty(&amp;quot;created_by_id&amp;quot;, params.item.getProperty(&amp;quot;created_by_id&amp;quot;)); &lt;br /&gt;&lt;span&gt;newItem&lt;/span&gt;.getItemByIndex(0).setProperty(&amp;quot;created_on&amp;quot;, params.item.getProperty(&amp;quot;created_on&amp;quot;)); &lt;br /&gt;&lt;span&gt;newItem&lt;/span&gt;.getItemByIndex(0).setProperty(&amp;quot;id&amp;quot;, params.item.getProperty(&amp;quot;id&amp;quot;)); &lt;br /&gt;&lt;span&gt;newItem&lt;/span&gt;.getItemByIndex(0).setProperty(&amp;quot;permission_id&amp;quot;, params.item.getProperty(&amp;quot;permission_id&amp;quot;)); &lt;br /&gt; &lt;br /&gt; return top.aras.uiShowItemEx(newItem.node, &amp;quot;tab view&amp;quot;, false, false); // in new tab&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;// open the dialog&lt;br /&gt;var topWnd = top.aras.getMostTopWindowWithAras();&lt;br /&gt;var wnd = topWnd ? topWnd : window;&lt;br /&gt;wnd.ArasModules.MaximazableDialog.show(&amp;quot;iframe&amp;quot;, params).promise.then(callback);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>