Kai_Kircher
5 years agoIdeator I
What is the best way to validate whether an item has a parent?
I'm trying to send an email on promotion to "Released" of Parts when a couple of criteria are met, the parts being of a certain custom classification we've added, and them not being used in another B...
- 5 years ago
Hi Kai Kircher
Easiest way to check whether the item is top level item or not, you can use below code
Innovator inn = this.getInnovator();
Item myResult;
if (this.getProperty("classification", "") == "Hull Assembly")
{
Item checkIsRoot = this.newItem("Part BOM","get");
checkIsRoot.setAttribute("select","id");
checkIsRoot.setAttribute("maxRecords","1");
checkIsRoot.setProperty("related_id",this.getID());
checkIsRoot = checkIsRoot.apply();
if(checkIsRoot.isError())
{
//email code
}
else
{
// This item has been used in some Part as BOM
}
}
return this;Thank You
Gopikrishnan R