<?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>.fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/f/development/55399/fetchrelationships-showing-outdated-data</link><description>Hello, 
 I have: 
 Promise () =&amp;gt; Method =&amp;gt; Back to Promise and perform .fetchRelatioships() of one of the items manipulated in the method. 
 
 There is still data in .fetchRelationships that should no longer be there, as Method was performing SQL deletions</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10818?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2025 09:30:17 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:bd21bd72-2e2a-47fc-b7c7-c00866569064</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;fetch is only used to get DB data.&lt;/p&gt;
&lt;p&gt;Easy example: You have manually opened a Part in Innovator. Typically the BOM relationship is visible too after you have opened the item.&lt;/p&gt;
&lt;p&gt;Now you can immediately use &amp;quot;get&amp;quot; to work with data from the BOM. Cause you already HAVE the data. It&amp;acute;s visible for you and present in the DOM. But if you need to work with data from the &amp;quot;AML&amp;quot; tab in a Method (without&amp;nbsp;opening&amp;nbsp;the&amp;nbsp;tab), you need to &amp;quot;fetch&amp;quot; the data first.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;fetch&amp;quot; is just a command for the item dog. (Greetings to&amp;nbsp;the attendees of Innovator Dev Course Gr&amp;ouml;benzell 2018)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10806?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 21:19:29 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:388b9fb2-5984-4386-b7a6-96696dfc1bb0</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;p&gt;Alright so .fetchRelationsihps wasn&amp;#39;t showing outdated data. It was showing the db data (as we should know)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why I assumed it was, was that the passed Item variable had&amp;nbsp;outdated data within its node xml&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To update the node&amp;#39;s xml, please look at my larger comment which talks of using .getItemsByXPath&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10803?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 21:08:54 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:1a8e805d-c59d-46f2-83c6-416b36dd3fb6</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;p&gt;Oh I just didn&amp;#39;t understand the C# method. All good, I don&amp;#39;t think the C# method is using outdated data actually. Sorry for the previous comments Aras, I am quick to convict another&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10802?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 20:59:17 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:b8360497-2933-4bc0-9a24-e0f87d2fcece</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;p&gt;In&amp;nbsp;the C# method it calls .fetchRelationship() which seems to be outdated there. What I ended up doing was just letting my JS function finish and no longer call the C# function. Then I made a second button for the user to press after the processing was complete&lt;/p&gt;
&lt;p&gt;If one tries to rebute by saying why not have JS promise method save the item and&amp;nbsp;configure a onAfterUpdate server event, I&amp;#39;d be careful with that, as the onAfterUpdate would likely finish first and would also still be using old data, or atleast would need constant eyes on that method or atleast a headache to watch over an onsave of that, well that&amp;#39;s me being lazy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10801?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 20:32:38 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4ef72870-0422-458a-9d00-e14d499e406e</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;p&gt;Ok so this does work - but. This works so the xmlDom is correct in the promise result.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am iffy on this: When I take that promise result, I call a C# method afterwards, and that method is acting oddly as the output of that method is as if the xml is still outdated, despite me calling the C# method with item.apply()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10800?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 19:47:08 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:85a4c06e-5373-46ba-9dc6-a948b195d72f</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;p&gt;Did not work either actually. The server requests are updated, but the variable&amp;#39;s dom still isn&amp;#39;t...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10799?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 19:41:56 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:bea68761-ea38-44d4-ae70-2f80a7d70f0d</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;p&gt;Nice I figured it out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Inside the method, any manipulation done to the item in question should be carefully ensured that any manipulation is referenced in the xmlDom&amp;#39;s own object (making a javascript copy of my variable which I will mention later still let the solution work (it did not inhibit it, it still worked))&lt;/p&gt;
&lt;p&gt;The item in question was activity.&amp;nbsp;The method&amp;nbsp;manipulated its relationships via SQL (problem as above, with bug of not updating for promise function) and I instead fetched the relationships, called getRelationships, and then specifically did .getItemsByXPath to get the record I wanted to delete. Calling getItemsByXPath on the variable assigned with .getRelationships meant that I was in fact using a pointer to the already existing xmlDom.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;From there, when the variable assigned with getItemsByXPath (&amp;lt;copying this one still works too), I was able to do .setAttribute(&amp;quot;action&amp;quot;, &amp;quot;delete&amp;quot;), .setAttribute(&amp;quot;id&amp;quot;, id) and then calling variable.apply(). This accomplished two things one: What the SQL already was doing (deleting), and 2: also updating the xmlDom of the Item activity for when I returned it it would reflect the operations done (the records were no longer there at all, hence the item with action=delete completed its performance and now was gone)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: .fetchRelationships() showing outdated data</title><link>https://www.aras.com/community/thread/10798?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 18:58:16 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:e060a464-5449-474f-bfd6-13f14f61b6b4</guid><dc:creator>Frank Guarino</dc:creator><description>&lt;div class="post-content user-defined-markup"&gt;
&lt;p&gt;Changing the requests in Method to AML did not work either&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="post-actions"&gt;
&lt;div class="navigation-list" data-maxlinks="2" data-direction="horizontal" data-reflow-wait-check-count="0" data-reflow-wait-timeout="null" data-finalized="true"&gt;
&lt;div class="container"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>