update a part's extended property through the iom


i have been able to update the extended property of a part through aml but i'm looking fo a sample code to understand how to do it with iom(innovator object model)



  • Hi Lucas

    Can you give a try using below code (Replace bold letters in below code)

    Innovator innovator = this.getInnovator();

    Item partEdit = innovator.newItem("Part", "edit");

    partEdit.setAttribute("id", "4F353307B92C40B5A9AADE4B1C857CDQ"); // Change with Part Item ID

    partEdit.setPropertyAttribute("xp-cost", "set", "value"); // Update the XProperty you want to update

    partEdit.setProperty("xp-cost", "100"); // Update the XProperty and its value

    partEdit = partEdit.apply();

    return partEdit;

    Thank You

    Gopikrishnan R

  • thank you very much,

    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

    i've tried with getitembyID followed by a getproperty/getpropertyAttribute(Name of my x Property)

    but without success if you also have a sample code for that or where to look for it would really help.


  • Hi Lucas

    xProperties cannot be accessed similar to other properties in item. You need to run below query and then access the xProperties

    Item partGet = innovator.newItem("Part", "get");
    partGet.setAttribute("id", "4F353307B92C40B5A9AADE4B1C857CDQ"); // Change with Part Item ID
    partGet.setAttribute("select", "xp-*"); //change to specific xProperty
    partGet = partGet.apply();

    string xProp = partGet.getProperty("xp-cost")
    return partGet;


    Gopikrishnan R

  • hello

    thanks it is working well.

    i have a last question related to this topic, how do you create a new part with Xproperties programatically?