<?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 get the table id?</title><link>https://www.aras.com/community/f/development/4018/how-to-get-the-table-id</link><description>I want to catch the id to select some information (table is Mi_Issue_Todolist).

But I can&amp;#39;t get the real id

Here is my script, please help me to resolve the problem, thank you~

Innovator inn = this.getInnovator();
string ContextId = this.getID();
Item</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to get the table id?</title><link>https://www.aras.com/community/thread/2245?ContentTypeID=1</link><pubDate>Wed, 07 Nov 2018 10:14:28 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:77249f80-f4c5-4fa3-9f01-fed1e9f615df</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

In an OnVote event the item stored in &lt;code&gt;this&lt;/code&gt; is the &lt;strong&gt;Activity&lt;/strong&gt; that is being voted on, not the work item of the workflow. To get the work item, you can use code like below to look up the item attached to the &lt;strong&gt;Workflow&lt;/strong&gt; being voted on.

&lt;pre&gt;&lt;code&gt;Innovator inn = this.getInnovator();
// In order to get the item this workflow is attached to, we first need to get the workflow
Item parentWorkflow = inn.newItem(&amp;quot;Workflow&amp;quot;, &amp;quot;get&amp;quot;);
parentWorkflow.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;source_id,source_type&amp;quot;);
Item workflowProcess = parentWorkflow.createRelatedItem(&amp;quot;Workflow Process&amp;quot;, &amp;quot;get&amp;quot;);
Item workflowProcessActivity = workflowProcess.createRelationship(&amp;quot;Workflow Process Activity&amp;quot;, &amp;quot;get&amp;quot;);
workflowProcessActivity.setProperty(&amp;quot;related_id&amp;quot;, this.getID());
parentWorkflow = parentWorkflow.apply();
// Now get the Item that this workflow is attached to
string sourceITName = parentWorkflow.getPropertyAttribute(&amp;quot;source_type&amp;quot;, &amp;quot;keyed_name&amp;quot;, &amp;quot;&amp;quot;);
Item workItem = inn.newItem(sourceITName, &amp;quot;get&amp;quot;);
workItem.setAttribute(&amp;quot;id&amp;quot;, parentWorkflow.getProperty(&amp;quot;source_id&amp;quot;, &amp;quot;&amp;quot;));
workItem = workItem.apply();&lt;/code&gt;&lt;/pre&gt;


Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the table id?</title><link>https://www.aras.com/community/thread/2244?ContentTypeID=1</link><pubDate>Wed, 07 Nov 2018 10:14:27 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:cb5dc36e-9bf8-4d65-a2d3-9b1275b0b472</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

In an OnVote event the item stored in &lt;code&gt;this&lt;/code&gt; is the &lt;strong&gt;Activity&lt;/strong&gt; that is being voted on, not the work item of the workflow. To get the work item, you can use code like below to look up the item attached to the &lt;strong&gt;Workflow&lt;/strong&gt; being voted on.

&lt;pre&gt;&lt;code&gt;Innovator inn = this.getInnovator();
// In order to get the item this workflow is attached to, we first need to get the workflow
Item parentWorkflow = inn.newItem(&amp;quot;Workflow&amp;quot;, &amp;quot;get&amp;quot;);
parentWorkflow.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;source_id,source_type&amp;quot;);
Item workflowProcess = parentWorkflow.createRelatedItem(&amp;quot;Workflow Process&amp;quot;, &amp;quot;get&amp;quot;);
Item workflowProcessActivity = workflowProcess.createRelationship(&amp;quot;Workflow Process Activity&amp;quot;, &amp;quot;get&amp;quot;);
workflowProcessActivity.setProperty(&amp;quot;related_id&amp;quot;, this.getID());
parentWorkflow = parentWorkflow.apply();
// Now get the Item that this workflow is attached to
string sourceITName = parentWorkflow.getPropertyAttribute(&amp;quot;source_type&amp;quot;, &amp;quot;keyed_name&amp;quot;, &amp;quot;&amp;quot;);
Item workItem = inn.newItem(sourceITName, &amp;quot;get&amp;quot;);
workItem.setAttribute(&amp;quot;id&amp;quot;, parentWorkflow.getProperty(&amp;quot;source_id&amp;quot;, &amp;quot;&amp;quot;));
workItem = workItem.apply();&lt;/code&gt;&lt;/pre&gt;


Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the table id?</title><link>https://www.aras.com/community/thread/2243?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 20:18:15 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:9fb01f15-f8f2-45e5-ae2b-fc28e9033731</guid><dc:creator>Former Member</dc:creator><description>Hello,

It&amp;#39;s in the &lt;strong&gt;Workflow&lt;/strong&gt;, the method is &lt;strong&gt;On Vote&lt;/strong&gt;!

The demand is when user vote something and press OK button, system can called the method and catch the id to know if some column is null...

Thank you for your help.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get the table id?</title><link>https://www.aras.com/community/thread/2242?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 09:07:35 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:a0fb0f4a-06ba-496f-a980-8f18a3489627</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

Could you let us know where this method is being called from? (e.g. an onBeforeAdd Server Event, an Action, etc.)

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>