<?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 Run already existing Action from a relationship</title><link>https://www.aras.com/community/f/development/36298/how-to-run-already-existing-action-from-a-relationship</link><description>I have this action which runs fine on an itemtype1, I want to use the same action to be triggered when i am on another itemtype2 but itemtype1 is in a relationship. 
 Currently im getting an error when i click that action from the relationship,</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to Run already existing Action from a relationship</title><link>https://www.aras.com/community/thread/6373?ContentTypeID=1</link><pubDate>Tue, 16 Feb 2021 08:17:48 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f6241b4f-0034-45ee-b2c7-d8d882311606</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Ah ok. Your question was about something different than I expected.&lt;/p&gt;
&lt;p&gt;For this usecase you can&amp;acute;t just copy paste my code, it was buggy anyway ;-)&lt;/p&gt;
&lt;p&gt;What do you want to achieve? What is your current code doing? You seem to call your Workflow map, but for which purpose?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Run already existing Action from a relationship</title><link>https://www.aras.com/community/thread/6367?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2021 08:00:01 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:93bf3921-a180-462e-90a3-797dadfd958f</guid><dc:creator>hkhan</dc:creator><description>&lt;p&gt;Hello Angelalp&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Im still getting error i added my code in your code below is that&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The action basically help triggers a workflow on an action, It works fine when i do it on an item type but it has issues when i do it on a relationship grid&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Innovator inn = this.getInnovator();&lt;br /&gt;Aras.IOM.Innovator innovator = this.getInnovator();&lt;br /&gt;// var myId;&lt;br /&gt;// var myItem;&lt;br /&gt;// Determine if Action was called from main grid or relationship grid&lt;br /&gt;var relatedId = this.getProperty(&amp;quot;related_id&amp;quot;,&amp;quot;&amp;quot;);&lt;/p&gt;
&lt;p&gt;// relatedId only exists when Action is called from relationship grid&lt;br /&gt;if (relatedId)&lt;br /&gt;{&lt;br /&gt;var myId = relatedId;&lt;br /&gt;var myItem = this.getPropertyItem(&amp;quot;related_id&amp;quot;);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;var myId = this.getID();&lt;br /&gt;var lytem = this;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;string workflowMapName = &amp;quot;VSY Task&amp;quot;;&lt;br /&gt;Item workflowMap = innovator.getItemByKeyedName(&amp;quot;Workflow Map&amp;quot;, workflowMapName);&lt;br /&gt;if ((workflowMap == null) | (workflowMap.getID().Length != 32))&lt;br /&gt;{&lt;br /&gt; return innovator.newError(&amp;quot;Unable to retrieve Workflow Map &amp;#39;&amp;quot; + workflowMapName + &amp;quot;&amp;#39;&amp;quot;);&lt;br /&gt;}&lt;br /&gt;// Instantiate and start the workflow.&lt;br /&gt;Item workflow = this.instantiateWorkflow(workflowMap.getID());&lt;br /&gt;if (workflow.isError())&lt;br /&gt;{&lt;br /&gt; return innovator.newError(&amp;quot;Error instantiating workflow: &amp;quot; + workflow.getErrorDetail());&lt;br /&gt;}&lt;br /&gt;workflow.startWorkflow();&lt;br /&gt;return this;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/3/pastedimage1613116708597v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Run already existing Action from a relationship</title><link>https://www.aras.com/community/thread/6366?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2021 07:41:31 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:c851f4be-ddea-4a18-b2c7-e8816e08186c</guid><dc:creator>AngelaIp</dc:creator><description>&lt;p&gt;Probably an issue with the id of your target Item. When you want to use an Action in a grid AND relationship grid, you have to differentiate this in your Method. There are a couple of ways to do this. This is one of them:&lt;/p&gt;
&lt;p&gt;var myId = null;&lt;br /&gt;var myItem = null; &lt;br /&gt;// Determine if Action was called from main grid or relationship grid&lt;br /&gt;var relatedId = this.getProperty(&amp;quot;related_id&amp;quot;,&amp;quot;&amp;quot;);&lt;/p&gt;
&lt;p&gt;// relatedId only exists when Action is called from relationship grid&lt;br /&gt;if (relatedId)&lt;br /&gt;{&lt;br /&gt;myId = relatedId;&lt;br /&gt;myItem = this.getPropertyItem(&amp;quot;related_id&amp;quot;);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;myId = this.getID();&lt;br /&gt; lytem = this;&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>