<?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 disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/f/development/38348/how-to-disable-delete-relationship-button-based-on-parent-item-state</link><description>I know this question has been asked multiple times and I have reviewed all the ones that had answers. None of them seemed to clearly lead me in the right direction. 
 I feel what I&amp;#39;m trying to do is a pretty basic use case. I&amp;#39;m trying to prevent affected</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/thread/10313?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 12:41:58 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:316f78f5-664a-41ec-9b1d-8a0991cdc1b6</guid><dc:creator>AJ Sebastian</dc:creator><description>&lt;p&gt;Thanks Angela, I&amp;#39;ll keep that in mind!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/thread/10312?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 12:40:41 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:7518822e-1184-4696-9f91-eea398f1f403</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Wow, what an answer, thanks for sharing! I am happy to see we get more and more people who raise the quality of posts in this forum! You even use dynamic labels/tooltips!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="/community/members/asebastian"&gt;AJ Sebastian&lt;/a&gt;&amp;nbsp;If you need some ideas for the community reboot Aras is&amp;nbsp;currently working on:&amp;nbsp;Aras from time to time could write some blog posts that highlight some TechTips or discussions from community. A lot of the useful stuff is often hard to find. This one is a perfect description of how to use init Methods. I wish I had had these kind of guide years ago!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/thread/10310?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 18:39:42 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f658650c-6d0e-4279-a5cf-5194fef14eed</guid><dc:creator>Adam Partlo</dc:creator><description>&lt;p&gt;Here is my complete solution for disabling the delete button when the ECN is In Review status or after.&lt;/p&gt;
&lt;p&gt;Open the ECN Item and go to Relationships tab. For this example, I am changing the ECN Affected Item.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712859526452v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Open the ECN Affected Item (Not the relationship)&lt;/p&gt;
&lt;p&gt;- Go to Client Style&lt;/p&gt;
&lt;p&gt;- Create a new Presentation Configuration (If already exists, just open the existing one)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712859675377v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Create a new CommandBarSection.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712859798644v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Open CommandBarSection created above.&lt;/p&gt;
&lt;p&gt;- Add the existing Command Bar Item: itemview.relationshipscommandbar.default.deleterow&lt;/p&gt;
&lt;p&gt;- Enter remaining fields per screen shot, except the Alternate. (we have to create this first)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712859935029v4.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Copy method:&amp;nbsp; cui_ivrcb_deleterow_init&lt;!--mce:protected %3C%21---0.248627%25--%3E--&gt;&amp;nbsp;and create a new method. Adjust the if statement as needed based on the LifeCycle States you want the button disabled for.&lt;!--mce:protected %3C%21---0.248627%25--%3E--&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712860461762v5.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;let isDisabled = true;&lt;br /&gt;if (window.computeCorrectControlState) {&lt;br /&gt; isDisabled = !window.computeCorrectControlState(&amp;#39;delete&amp;#39;);&lt;br /&gt; &lt;br /&gt;let parentItemLifeCycleState = parent.thisItem.getProperty(&amp;#39;state&amp;#39;, null);&lt;/p&gt;
&lt;p&gt;if (parentItemLifeCycleState === &amp;#39;In Review&amp;#39; || parentItemLifeCycleState === &amp;#39;Checker&amp;#39;&lt;br /&gt; || parentItemLifeCycleState === &amp;#39;Final Approval&amp;#39; || parentItemLifeCycleState === &amp;#39;Released&amp;#39;)&lt;br /&gt;{&lt;br /&gt; isDisabled = true;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;br /&gt;const tooltip = target.tooltip_template.replace(&lt;br /&gt; &amp;#39;{0}&amp;#39;,&lt;br /&gt; options.relationshipItemTypeLabel&lt;br /&gt;);&lt;br /&gt;return {&lt;br /&gt; disabled: isDisabled,&lt;br /&gt; tooltip_template: tooltip&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Open the Command Bar Item above (this will open the existing Command Bar Item)&lt;/p&gt;
&lt;p&gt;- Click the ... -&amp;gt; Create New Button&lt;/p&gt;
&lt;p&gt;- Fill in the fields as shown.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712860539765v6.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The delete button should now be disabled when the ECN is not in New or In Work states.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- If you are not getting the results you expect, clear your Metadata cache.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/community/resized-image/__size/640x480/__key/communityserver-discussions-components-files/3/pastedimage1712860771907v7.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/thread/10309?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 13:41:44 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4b0e8b12-ae19-4234-ba51-e43c24385ef6</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Ah I see - you were looking for &amp;quot;perfection&amp;quot; in the UI!&lt;span class="emoticon" data-url="https://www.aras.com/community/cfs-file/__key/system/emoji/1f600.svg" title="Grinning"&gt;&amp;#x1f600;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When reading the post I couldn&amp;acute;t tell if the question was a beginner question from somebody who hardly can navigate Innovator or from someone that already does more complex stuff. I see you are more in category 2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The custom onInit Method for the CUI element is the most precise way to achieve what you want to have.&lt;br /&gt;The official solution from support does exactly that. Thanks for the feedback!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/thread/10308?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 13:34:56 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4592ab9f-0471-4a40-8758-6a8ac756bb77</guid><dc:creator>Adam Partlo</dc:creator><description>&lt;p&gt;&lt;a href="/community/members/angela"&gt;AngelaIp&lt;/a&gt;&amp;nbsp;I appreciate the feedback, but ultimately I also want to override the new button as well. From a user standpoint, I find it odd when a button is there to click when I know I will get an error message of some sort after pressing it. That is basically what the onBeforeDelete Relationship grid event would do.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Wanted to let everyone know that Aras supports suggests the following steps.&lt;/p&gt;
&lt;p&gt;CUI engine is the best choice for such manipulations with UI.&lt;/p&gt;
&lt;p&gt;High level steps:&lt;/p&gt;
&lt;p&gt;1) Create itemType Presentation configuration for relationship item where toolbar you want to modify (see example with detailed steps from documentation, details is below)&lt;/p&gt;
&lt;p&gt;2) follow the documentation to replace the button by custom one (custom one will be exact copy with copy as new method event handlers click and init)&lt;/p&gt;
&lt;p&gt;3) modify copied onInit method on a button and add your IF condition like below (this button will replace standard one only for your itemType where custom method onInit as exact copy of standard logic will be executed with custom if condtition of course):&lt;/p&gt;
&lt;p&gt;method: cui_ivrcb_deleterow_init_copy&lt;/p&gt;
&lt;p&gt;let parentItemLifeCycleState = parent.Item.getProperty(&amp;#39;state&amp;#39;, null);&lt;/p&gt;
&lt;p&gt;if (&lt;span&gt;parentItemLifeCycleState&amp;nbsp;=== &amp;#39;In Review&amp;#39; ||&amp;nbsp;parentItemLifeCycleState&amp;nbsp;=== &amp;#39;Released&amp;#39;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; isDisabled = true;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you have access to the documentation,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You can have a look on documentation example how to replace standard CUI button by custom one where you can modify onInit js method where will be required to modify init condition for this button and and condition to disable button.&lt;/p&gt;
&lt;p&gt;Documentation\Aras Innovator XX - Configurable User Interface Administrator Guide.pdf (XX your version of innovator)&lt;/p&gt;
&lt;p&gt;- Section 5.1.4 (Replace a button on a toolbar)&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I am currently working on implementing this update based on the above recommendation and will provide some screenshots of my solution when I have it completed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable delete relationship button based on parent item state?</title><link>https://www.aras.com/community/thread/10307?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 13:17:40 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:01806dc8-8c64-42aa-895b-673673dd3799</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;I wonder if it&amp;acute;s wise to focus just on the delete button. The OOTB ECN doesn&amp;acute;t use a state permission for &amp;quot;In Review&amp;quot; in the lifecycle. So it reuses the &amp;quot;In Work&amp;quot; permission which allows certain people to edit the ECN on review. The usual way to prevent edit in Review is simply to use a specific Permission for this state. Check the LifeCycleMap and you should easily see, which permission is used for which state.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are multiple ways to delete the ECN Affected Item button itself, but people still could edit the rest of the ECN. One option is a onBeforeDelete RelationshipType event (return false if state is xy) or overwriting the CUI element itself. But from my POV more Permissions are the most common solutions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>