Former_Member
9 years agoAccelerator III
Unable to increment Revision of "Affected Item" under ECN using AML code
Hi All,
The below code is used to increment the revision of the affected item under ECN and set the new value to New Item Revision property under the "Affected Item" Itemtype. This code is working properly in Aras 9.2 but not incrementing the revision as expected in Aras 11.5.
Unlike 9.2, the "generation" property of Affected Item, ECN Affected Item and other ItemTypes is not set to "Unique" by default in 11.5.
When I tried to set the generation of any ItemType to "Unique", the below error occurs -
" The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name innovator.AFFECTED_ITEM...".
Please let me know if the above default generation configuration is the cause for this failure of below "action=version" code and the resolution to fix this issue as it is preventing the ECN release.
Appreciate your quick response!
Item affItem = affItemRel.createRelatedItem("Affected Item","get");
affItem.setAttribute("select","action,interchangeable,affected_id(keyed_name,state,is_released,itemtype),new_item_id(keyed_name,state,config_id,itemtype)");
Item thisItem = affItemRel.getItemsByXPath(rootXPath+"Item[@type='Affected Item'][action='Change'][interchangeable='1'][../../@id='"+thisId+"']");
if (thisItem.getItemCount() == 1)
{
Item tempItem = this.newItem();
tempItem.loadAML("<Item typeId='"+thisItem.getPropertyItem("affected_id").getProperty("itemtype", "")+"' action='version'/>");
tempItem.setID(thisItem.getProperty("affected_id","NON_EXISTING"));
tempItem = tempItem.apply();
affItem = this.newItem("Affected Item","edit");
affItem.setID(thisItem.getID());
affItem.setAttribute("serverEvents","0");
affItem.setAttribute("doGetItem","0");
affItem.setProperty("new_item_id",tempItem.getID());
affItem = affItem.apply();
}
Regards,
Charita