Get item using multiple Where conditions and edit the item

I am trying to edit the State of a Part with a specific generation, "1". 

The output of the following is just  "<Result/>"

Innovator innovator = this.getInnovator();
string configId = this.getProperty("config_id");
Item itm = this.newItem("Part", "edit");
itm.setAttribute("where","part.item_number='11-1-1D123' AND part.generation='1'");
itm.setProperty("state","Released");
return itm.apply();

However, if I use "setProperty" with "get" in separate lines I get the correct output. However, I can't use "setProperty" to filter with "edit" because it sets a new value for the property. Below is the code:

Innovator innovator = this.getInnovator();
string configId = this.getProperty("config_id");
Item itm = this.newItem("Part", "get");
itm.setAttribute("select", "id,generation,major_rev,state,item_number");
itm.setProperty("generation", "1");
itm.setProperty("item_number", "11-1-1D123");
return itm.apply();

Parents
  • "State" property cannot be edited this way, cause state is changed due to promotion of the LifeCycle. So what you want to do requires the AML action "promoteItem" and not "edit".

  • Thanks!  Do you know why is the output "<Result/>" when more than one condition is used in the "where" clause. 
    Also, when the output is  "<Result/>"  it doesn't "edit" either. If  "<Result/>"  is just an item the part should at least be edited, correct?
    Also, where do I find more information on AML action "promoteItem". I need to see some examples of this or just some documentation outlining the use of methods in AML. Super new to Aras here. 

  • Classic promote looks like this:

    x.setAction("promoteItem");
    x.setProperty("state","Released");
    x.setProperty("comments", "it´s a lot of fun..."); // History comment
    x= x.apply();
    if (x.isError())

    Your empty result is not caused by more than one condition, but if one condition fu** things up.
    If you always include condition generation=1, but the item already have 12 generation, your query will fail. You cannot edit old generations of an item with AML. It´s something that is restricted. This requires editing via SQL, which I wouldn´t recommend to use in the beginning if you are not familiar with the database structure and it´s dependencies . From my POV Aras should allow editing old generation under certain conditions, but they will never change that.

    When you are an subscriber, try to attend in the dev trainings as soon as possible were a lot of this general query stuff is covered.

Reply
  • Classic promote looks like this:

    x.setAction("promoteItem");
    x.setProperty("state","Released");
    x.setProperty("comments", "it´s a lot of fun..."); // History comment
    x= x.apply();
    if (x.isError())

    Your empty result is not caused by more than one condition, but if one condition fu** things up.
    If you always include condition generation=1, but the item already have 12 generation, your query will fail. You cannot edit old generations of an item with AML. It´s something that is restricted. This requires editing via SQL, which I wouldn´t recommend to use in the beginning if you are not familiar with the database structure and it´s dependencies . From my POV Aras should allow editing old generation under certain conditions, but they will never change that.

    When you are an subscriber, try to attend in the dev trainings as soon as possible were a lot of this general query stuff is covered.

Children
No Data