<?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/"><channel><title>Smith589 さんのアクティビティ</title><link>https://www.aras.com/community/members/smith589</link><description>Smith589 さんの最近のアクティビティ</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>Context from method to called email</title><link>https://www.aras.com/community/f/development/36745/context-from-method-to-called-email</link><pubDate>Tue, 27 Jul 2021 18:02:58 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:aa04475c-7c50-4f24-a65b-e8d7893e28db</guid><dc:creator>Kai Kircher</dc:creator><description>&lt;p&gt;I&amp;#39;ve got an email that I&amp;#39;m calling from a &amp;quot;post&amp;quot; method on the Part lifecycle, but the default context that&amp;#39;s passed to that email message isn&amp;#39;t the Part, it instead seems to be the alphabetically first Identity in my database?&lt;/p&gt;
&lt;p&gt;Why is this happening, and is it possible to (and how can I) pass the Part as the context item to the email, so I can use xpath variables for that part in the email?&lt;/p&gt;
&lt;p&gt;Alternatively, if there&amp;#39;s a good way to just find the part that&amp;#39;s being promoted via the email message query, that&amp;#39;s fine too. That&amp;#39;s the goal, however I need to get there.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the method that&amp;#39;s running, for what it&amp;#39;s worth:&lt;/p&gt;
&lt;p&gt;Innovator inn = this.getInnovator();&lt;/p&gt;
&lt;p&gt;if (this.getProperty(&amp;quot;classification&amp;quot;, &amp;quot;&amp;quot;) == &amp;quot;Hull Assembly&amp;quot;) &lt;br /&gt;{&lt;br /&gt; Item checkIsRoot = this.newItem(&amp;quot;Part BOM&amp;quot;,&amp;quot;get&amp;quot;);&lt;br /&gt; checkIsRoot.setAttribute(&amp;quot;select&amp;quot;,&amp;quot;id&amp;quot;);&lt;br /&gt; checkIsRoot.setAttribute(&amp;quot;maxRecords&amp;quot;,&amp;quot;1&amp;quot;);&lt;br /&gt; checkIsRoot.setProperty(&amp;quot;related_id&amp;quot;,this.getID());&lt;br /&gt; checkIsRoot = checkIsRoot.apply();&lt;br /&gt; if(checkIsRoot.isError())&lt;br /&gt; {&lt;br /&gt; //First grab an identity to send the mail to. &lt;br /&gt; Item iden = inn.getItemById(&amp;quot;Identity&amp;quot;, &amp;quot;097FB092EBDE42EB9E5A274ABC0059DA&amp;quot;);&lt;br /&gt; //Next, grab the email we want&lt;br /&gt; Item myResult = inn.applyAML(&amp;quot;&amp;lt;AML&amp;gt;&amp;quot;+&lt;br /&gt; &amp;quot;&amp;lt;Item type=&amp;#39;Email Message&amp;#39; action=&amp;#39;get&amp;#39;&amp;gt;&amp;quot;+&lt;br /&gt; &amp;quot;&amp;lt;name&amp;gt;BOM_Release&amp;lt;/name&amp;gt;&amp;quot;+&lt;br /&gt; &amp;quot;&amp;lt;/Item&amp;gt;&amp;lt;/AML&amp;gt;&amp;quot;);&lt;br /&gt; Item myEmail = myResult.getItemByIndex(0);&lt;br /&gt; iden.email(myEmail, iden);&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;return this;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>