<?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>Save item transaction</title><link>https://www.aras.com/community/f/development/6145/save-item-transaction</link><description>Hello 
 I have a certain Item1 and on after save event of this item I trigger another item2 (custom item we created) save. In case first one fails the second wont trigger. But the otherway around obviously doesnt work. This is handled client side. 
 Is</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3186?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2019 05:17:15 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:589ffaae-9d6c-4579-9c4b-5cf985bdb0ef</guid><dc:creator>detroit</dc:creator><description>&lt;p&gt;Thank you for now Mr Gillis I will have to come back when i&amp;#39;ve started hacking at this. I will definitely use the information from this thread!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3184?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 14:24:30 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:e83df0ec-3b15-4a7b-84f2-c86bb7924598</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can use CUI to add a new button as outlined in this &lt;a href="/b/english/posts/creating-a-custom-refresh-button-using-cui"&gt;blog post&lt;/a&gt;. You can then follow relatively similar steps to disable the existing Save button. If you run into any trouble with the exact implementation of this CUI button, I&amp;#39;d recommend creating a new forum post to ask for help since it&amp;#39;s a much different question to the one you originally asked.&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3180?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2019 05:13:05 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:fca909ea-f164-4a39-a849-f965db63ca6c</guid><dc:creator>detroit</dc:creator><description>&lt;p&gt;Technically i could take the aml of the object then used the loadAML and started adding logics on the serverside. I dont think my colleague will be all too happy:)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Btw is there a way to override the save button on specific form (item type)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3175?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 14:17:54 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f5777ea8-4d7f-4f43-b1a5-ee729204f687</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;This kind of transaction rollback exists inherently inside of Aras Innovator. For example, if I run the method code below, the transaction that created the Part will be rolled back because of the error thrown at the end.&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;Innovator inn = &lt;/span&gt;&lt;span&gt;this&lt;/span&gt;&lt;span&gt;.getInnovator();&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;// Create a new part&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;Item part = inn.newItem(&lt;/span&gt;&lt;span&gt;&amp;quot;Part&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&amp;quot;add&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;part.setProperty(&lt;/span&gt;&lt;span&gt;&amp;quot;item_number&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&amp;quot;My Part 1&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;part.apply();&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;// The part now exists in the database&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;// But the transaction is rolled back when this error is thrown&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;// If we check for the part after running this method, it will not exist&lt;/span&gt;&lt;/div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; inn.newError(&lt;/span&gt;&lt;span&gt;&amp;quot;Can not add part&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This kind of transaction rolls back for any number of nested server calls.&amp;nbsp;For instance, if I call another method which successfully creates an item and then throw an error, the item created in the&amp;nbsp;called method is still part of the same transaction and will be rolled back when the error is thrown from the calling method. Similarly, if an error is thrown in a server event, any and all transactions associated with the triggering item or&amp;nbsp;any other server events&amp;nbsp;will be rolled back.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d suggest taking a look at your existing approach to see if some of this logic could be migrated from the client to the server. We typically recommend keeping this kind of logic inside of a server event so that the same functionality will be run whether the item is saved through the client or an external application.&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3168?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 05:12:56 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:2cde6e63-04e3-4247-8241-8ee315a89f76</guid><dc:creator>detroit</dc:creator><description>&lt;p&gt;Mr. Gillis my 2nd item (or items) are made after first one is created. I&amp;#39;ll show you excerpt of the code&lt;/p&gt;
&lt;p&gt;1. registered handler. So when i save Item1 i call some_method which goes over Item1 (its properties and relationships etc...)&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;mainWnd&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;registerCommandEventHandler&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;window&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;span style="font-family:inherit;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:inherit;"&gt;some_method&lt;/span&gt;&lt;span style="font-family:inherit;"&gt;();&lt;/span&gt;&lt;span&gt;&amp;nbsp;}, &lt;/span&gt;&lt;span&gt;&amp;#39;after&amp;#39;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&amp;#39;save&amp;#39;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;2.&amp;nbsp;some_method as said iterates over props and relationship of Item1&amp;nbsp; and calls several different serverside methods which add, delete or update various Item2 types&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Item2 is not&amp;nbsp;handled in onAfterAdd of Item2 due to specific logics. Not sure if even it could be done (I didnt create those methods). Come to think of it I cant do mine nor your ideas. My first idea would maybe work (with loads of rework) if i could calll single AML for item1 with addition of method calls for Item2 inside the same tag. But i don&amp;#39;t see how that would work as a single transaction. Is that possible?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Better sollution would be if AML calls in serverside &amp;nbsp;would return some kind of tx which i could rollback later if any subsequent tx fails - is this possible?&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3160?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2019 13:31:24 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6d71aad7-8842-42b9-be5a-22b336c5c158</guid><dc:creator>Christopher Gillis</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I think this idea of adding another item to the transaction AML could work, but it would need to be done in an onBeforeAdd server event instead of an onAfterAdd server event.&lt;/p&gt;
&lt;p&gt;As an alternative, you could add the attribute&amp;nbsp;&lt;em&gt;serverEvents=&amp;quot;0&amp;quot;&lt;/em&gt; when you create the second item in the onAfterAdd server event. This will prevent the creation of that item from triggering another server event and will prevent an infinite loop.&lt;/p&gt;
&lt;p&gt;You can add this programmatically using the line below.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;myItem.setAttribute(&amp;quot;serverEvents&amp;quot;, &amp;quot;0&amp;quot;);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;
&lt;p&gt;Christopher Gillis&lt;/p&gt;
&lt;p&gt;Aras Labs Software Engineer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Save item transaction</title><link>https://www.aras.com/community/thread/3159?ContentTypeID=1</link><pubDate>Mon, 08 Jul 2019 11:00:32 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:353933c7-d0aa-4837-bb6f-3d6cd3c925bc</guid><dc:creator>detroit</dc:creator><description>&lt;p&gt;I was entertaining the idea to catch the save AML and inject it with the other item aml since i&amp;#39;ve read whatever is inside AML tag is considered one transaction. How can you catch save AML and prevent execution?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>