<?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>update a part&amp;#39;s extended property through the iom</title><link>https://www.aras.com/community/f/development/36716/update-a-part-s-extended-property-through-the-iom</link><description>hello, 
 i have been able to update the extended property of a part through aml but i&amp;#39;m looking fo a sample code to understand how to do it with iom(innovator object model) 
 thanks, 
 Lucas</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: update a part's extended property through the iom</title><link>https://www.aras.com/community/thread/7168?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 11:15:07 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:716f45ca-d967-4c01-8efd-3cc7b2d95509</guid><dc:creator>lucas</dc:creator><description>&lt;p&gt;Here is a sample code that creates&amp;nbsp;&lt;span&gt;&amp;nbsp;a new part and sets Xproperties values programatically for those interested:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;var inn = aras.IomInnovator;

var part = inn.newItem(&amp;quot;Part&amp;quot;, &amp;quot;add&amp;quot;);
part.setProperty(&amp;quot;name&amp;quot;, &amp;quot;testing0&amp;quot; ) ;
var Part_xclass= part.createRelationship(&amp;quot;Part_xClass&amp;quot;, &amp;quot;add&amp;quot;);

var xclass= Part_xclass.createRelatedItem(&amp;quot;xClass&amp;quot;, &amp;quot;get&amp;quot;);

xclass.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;&amp;#39;id&amp;#39;&amp;quot;);
xclass.setProperty(&amp;quot;name&amp;quot;, &amp;quot;resistor&amp;quot; ) ;//your part&amp;#39;s xclassname 
part.setPropertyAttribute(&amp;quot;xp-valeur_resistance&amp;quot;, &amp;quot;set&amp;quot;, &amp;quot;value&amp;quot;); // Update the XProperty you want to update
part.setProperty(&amp;quot;xp-valeur_resistance&amp;quot;, &amp;quot;667&amp;quot;); //the value you want for the XProperty you want to update

console.log(&amp;quot;part before apply: &amp;quot;+part.ToString());//for debug purposes

part = part.apply();
if(part.isError()|| part.getItemCount() !== 1)
{
    console.log(&amp;quot;part error:&amp;quot;+part.getErrorDetail());
    return inn.newError(part.getErrorDetail());
}
else
{
    alert(part.ToString());
    console.log(&amp;quot;part after apply: &amp;quot;+part.ToString());
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update a part's extended property through the iom</title><link>https://www.aras.com/community/thread/7150?ContentTypeID=1</link><pubDate>Fri, 23 Jul 2021 12:41:12 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:fb898c72-acb1-4fa4-9f59-675d71133743</guid><dc:creator>lucas</dc:creator><description>&lt;p&gt;hello&lt;/p&gt;
&lt;p&gt;thanks it is working well.&lt;/p&gt;
&lt;p&gt;i have a last question related to this topic, how do you create a new part with Xproperties programatically?&lt;/p&gt;
&lt;p&gt;Lucas.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update a part's extended property through the iom</title><link>https://www.aras.com/community/thread/7128?ContentTypeID=1</link><pubDate>Wed, 21 Jul 2021 05:44:01 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:72ced0fb-21ed-4fa2-a132-6f081a7cfe36</guid><dc:creator>Gopikrishnan</dc:creator><description>&lt;p&gt;Hi Lucas&lt;/p&gt;
&lt;p&gt;xProperties cannot be accessed similar to other properties in item. You need to run below query and then access the xProperties&lt;/p&gt;
&lt;p&gt;Item partGet = innovator.newItem(&amp;quot;Part&amp;quot;, &amp;quot;get&amp;quot;);&lt;br /&gt;partGet.setAttribute(&amp;quot;id&amp;quot;, &amp;quot;4F353307B92C40B5A9AADE4B1C857CDQ&amp;quot;); // Change with Part Item ID&lt;br /&gt;partGet.setAttribute(&amp;quot;select&amp;quot;, &amp;quot;xp-*&amp;quot;); //change to specific xProperty&lt;br /&gt;partGet = partGet.apply();&lt;/p&gt;
&lt;p&gt;string xProp = &lt;span&gt;partGet&lt;/span&gt;.getProperty(&amp;quot;xp-cost&amp;quot;)&lt;br /&gt;return partGet;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Gopikrishnan R&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update a part's extended property through the iom</title><link>https://www.aras.com/community/thread/7127?ContentTypeID=1</link><pubDate>Tue, 20 Jul 2021 14:42:59 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:3db31062-507d-464c-b410-e0a62a1fdf92</guid><dc:creator>lucas</dc:creator><description>&lt;p&gt;thank you very much,&lt;/p&gt;
&lt;p&gt;I am also having trouble getting an xproperty value from an item. i have an id of an item and want to get the value of some of its xproperties&lt;/p&gt;
&lt;p&gt;i&amp;#39;ve tried with getitembyID followed by a getproperty/getpropertyAttribute(Name of my x Property)&lt;/p&gt;
&lt;p&gt;but without success if you also have a sample code for that or where to look for it would really help.&lt;/p&gt;
&lt;p&gt;Lucas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: update a part's extended property through the iom</title><link>https://www.aras.com/community/thread/7120?ContentTypeID=1</link><pubDate>Mon, 19 Jul 2021 17:05:16 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:b851243f-d0d8-44cf-bb52-7e006024e3e0</guid><dc:creator>Gopikrishnan</dc:creator><description>&lt;p&gt;&lt;strong&gt;Hi Lucas&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Can you give a try using below code (Replace bold letters in below code)&lt;/p&gt;
&lt;p&gt;Innovator innovator = this.getInnovator();&lt;/p&gt;
&lt;p&gt;Item partEdit = innovator.newItem(&amp;quot;Part&amp;quot;, &amp;quot;edit&amp;quot;);&lt;/p&gt;
&lt;p&gt;partEdit.setAttribute(&amp;quot;id&amp;quot;, &amp;quot;&lt;strong&gt;4F353307B92C40B5A9AADE4B1C857CDQ&lt;/strong&gt;&amp;quot;); // Change with Part Item ID&lt;/p&gt;
&lt;p&gt;partEdit.setPropertyAttribute(&amp;quot;&lt;strong&gt;xp-cost&lt;/strong&gt;&amp;quot;, &amp;quot;set&amp;quot;, &amp;quot;value&amp;quot;); // Update the XProperty you want to update&lt;/p&gt;
&lt;p&gt;partEdit.setProperty(&amp;quot;&lt;strong&gt;xp-cost&lt;/strong&gt;&amp;quot;, &amp;quot;&lt;strong&gt;100&lt;/strong&gt;&amp;quot;); // Update the XProperty and its value&lt;/p&gt;
&lt;p&gt;partEdit = partEdit.apply();&lt;/p&gt;
&lt;p&gt;return partEdit;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank You&lt;/p&gt;
&lt;p&gt;Gopikrishnan R&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>