<?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>poly item add column</title><link>https://www.aras.com/community/f/development/3596/poly-item-add-column</link><description>Hi

I create ItemType&amp;#160; Implementation Type chouse Poly Item and Poly Sources add&amp;#160; two ItemType A ,B.

I want add property &amp;quot;notes&amp;quot; but this property not in A and B. This property for user when add A or B can wirte notes something.

But I add property notes</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: poly item add column</title><link>https://www.aras.com/community/thread/1363?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2018 02:45:58 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:4d0b71ff-57cb-4353-bd1f-8c53bee3e41a</guid><dc:creator>Yoann Maingon</dc:creator><description>yes properties need to be existing on each polysource.

here is a sample method I have used when working with polyitems. It allows you to automaticaly push a new property from the polyitem to the polysource (also I realize I&amp;#39;m looping on an apply(), this could be enhanced)
&lt;pre&gt;// Get innovator ref
Innovator inn = this.getInnovator();

// retrieve the Poly-itemtype
Item polyItemType = inn.getItemById(&amp;quot;ItemType&amp;quot;, this.getProperty(&amp;quot;source_id&amp;quot;));

// retrieve the added property name
String newPropertyName = this.getProperty(&amp;quot;name&amp;quot;);

// test if the itemtype is a polyitemtype
if (polyItemType.getProperty(&amp;quot;implementation_type&amp;quot;) == &amp;quot;polymorphic&amp;quot;){
    
    // get polysources
    polyItemType.fetchRelationships(&amp;quot;Morphae&amp;quot;);
    Item Morphaes = polyItemType.getRelationships(&amp;quot;Morphae&amp;quot;);
    
    // for each source - check if the property exists 
    for (int i = 0; i &amp;lt; Morphaes.getItemCount(); i++)
    {
        // get the morphae
        Item Morphae = Morphaes.getItemByIndex(i).getRelatedItem();
        Morphae.fetchRelationships(&amp;quot;Property&amp;quot;);
        
        // test if it has the added property (check just by name)
        if (Morphae.getRelationships(&amp;quot;Property&amp;quot;).getItemsByXPath(&amp;quot;//Item[name='"+newPropertyName+"']&amp;quot;).getItemCount() &amp;lt; 1){
            
            // Clone the property
            Item distributedProperty = this.clone(false);
            
            // Add the Property
            distributedProperty.setProperty(&amp;quot;source_id&amp;quot;,Morphae.getID());
            
            // Perform the query.
            Item results = distributedProperty.apply();
        }
        
    }

}

return this;
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>