<?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>Post Processing logic on Clicking Save button in Pick related Window on a relationship Tab</title><link>https://www.aras.com/community/f/development/9150/post-processing-logic-on-clicking-save-button-in-pick-related-window-on-a-relationship-tab</link><description>We have a Requirement as Following . We have a list of Master Exam list (around 500 Items) . When I go to a Project, I need to perform a subset of exams (e.g 100) out of 500 Master list .For that When I go to Project &amp;gt; Exam Tab&amp;gt;Click on Pick Related </description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: Post Processing logic on Clicking Save button in Pick related Window on a relationship Tab</title><link>https://www.aras.com/community/thread/4470?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 14:10:30 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c680caeb-82cd-4052-b7d0-3b03787a5cdf</guid><dc:creator>cogres</dc:creator><description>&lt;p&gt;No problem &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;. Let me know how it goes!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Post Processing logic on Clicking Save button in Pick related Window on a relationship Tab</title><link>https://www.aras.com/community/thread/4468?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 13:54:27 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:d74e4440-3bea-4f43-a8d2-ab8e596f69ae</guid><dc:creator>smruti.barik</dc:creator><description>&lt;p&gt;Thank you so much for detailed response. I will try it and let you know the result .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Post Processing logic on Clicking Save button in Pick related Window on a relationship Tab</title><link>https://www.aras.com/community/thread/4467?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 13:16:30 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:0441c1e8-16e1-4fc4-9801-2fea0a1fbcba</guid><dc:creator>cogres</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;yes this is certainly possible. If I understand you correctly, you can achieve the functionality you need by implementing an onBeforeAdd (or similar) method on the relationship ItemType between Project and MEL (I&amp;#39;m assuming this is called PMEL from here on).&lt;br /&gt;&lt;br /&gt;One thing to note before I start: I am assuming with &amp;quot;saving&amp;quot; you are referring to saving the changes on the Project after you have added the MELs to it, not the &amp;quot;Confirm selection&amp;quot; tick mark you click when selecting related MELs. Since you are not committing any relationship or property changes on the Project Item to the database before you save it, I do not believe it makes much sense to put the logic on the selection event for related MELs.&lt;br /&gt;In any case, here&amp;#39;s how I would go about implementing the logic triggered onSave of the Project (which is when the relationship items get created, hence onBeforeAdd triggers for PMEL):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a method that will contain the creation logic for the PEL objects, here I will call it CreatePels
&lt;ul&gt;
&lt;li&gt;For some thoughts on what would be going on in CreatePels, see below&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Open ItemType PMEL and lock (edit) it&lt;/li&gt;
&lt;li&gt;Go to the tab &amp;quot;Server Events&amp;quot;&lt;/li&gt;
&lt;li&gt;Search for and add CreatePels
&lt;ul&gt;
&lt;li&gt;Set &amp;quot;Event&amp;quot; to be &amp;quot;onBeforeAdd&amp;quot;&lt;/li&gt;
&lt;li&gt;Set &amp;quot;Event Version&amp;quot; to &amp;quot;Version 1&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Save, unlock and close ItemType PMEL&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, when you save a project after adding MELs to it, CreatePels will trigger and create your corresponding PELs.&lt;br /&gt;&lt;br /&gt;In CreatePels, you have access to the Project ID via &lt;code&gt;this.getProperty(&amp;quot;source_id&amp;quot;, &amp;quot;&amp;quot;)&lt;/code&gt; and the MEL ID via &lt;code&gt;this.getProperty(&amp;quot;related_id&amp;quot;, &amp;quot;&amp;quot;)&lt;/code&gt;. Via this related_id you would also obtain all the MEL attributes that you need to map to your new PEL. Just be sure not to alter &amp;quot;this&amp;quot; (which is the to-be-added relationship between Project and MEL) and to &amp;quot;return this&amp;quot; at the end of the method.&lt;br /&gt;Note that for each MEL you add to the Project, CreatePels gets triggered once. So if you add three MELs to your Project, CreatePels gets triggered three times.&lt;br /&gt;&lt;br /&gt;Another thing you could do is put the method on the Project ItemType with event onBeforeUpdate or something similar. In this case, the method would only trigger once, but you&amp;#39;d have to get a hold of the MELs you added to the project in a different way. I find the PMEL approach more straightforward and intuitive.&lt;br /&gt;&lt;br /&gt;Hope this helps,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;C&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>