Hi Cogres ,
Thank you for your response ,
it was really Helpful ,but just to know , I am using a C# method
I have an other question please ,
In my code there is a case where I should promote the current Item
so here is the code I have used :
//Obtain the Innovator instance from the Context Item
Innovator inn = this.getInnovator();
//Get the hexa id of the current EDM Part item
string ID = this.getID();
//Get the latest Part item with id "ID"
Item latest = inn.getItemById("Part",ID);
//Get the latest Part state
string latestate = latest.getProperty("state");
if(string.Equals(latestate, "serie", StringComparison.OrdinalIgnoreCase)){
//get the list of generations of the current Part Item
String config_id = latest.getProperty("config_id");
Item allVersions = inn.newItem("Part", "get");
allVersions.setAttribute("orderBy", "generation");
allVersions.setProperty("config_id", config_id);
allVersions.setPropertyAttribute("id", "condition", "is not null");
allVersions = allVersions.apply();
//get the Item count of the versions
int vercount = allVersions.getItemCount();
for(int i=0; i<vercount; i++)
{
Item ItemI = allVersions.getItemByIndex(i);
string state = ItemI.getProperty("state");
//string generation = allVersions.getItemByIndex(i).getProperty("generation");
if(string.Equals(state, "serie", StringComparison.OrdinalIgnoreCase))
{
string NextState = "Auslauf";
ItemI.setAction("promoteItem");
ItemI.setProperty("state", NextState);
ItemI = ItemI.apply();
}
}
}
return latest.apply();
the code written in Bold Format is what I have used to promote the Item
is these instructions are Correct ? , or do you have a better method ?
Thanks in Advance
Hamdi