Hi, When a Part gets deleted i would like the corresponding entry in the Manufacturer Part also be deleted. But for purge this should not happen is there a way to differentiate between the two actions. I added a method to the onBeforeDelete event of Part and included this.
if (this.getAction().ToLower() == "delete") { //delete from manufacturer part Item manufPart = this.newItem("Manufacturer Part", "delete"); manufPart.setAttribute("where", "item_number = '" + part.getProperty("item_number") + "'"); manufPart = manufPart.apply(); if (manufPart.isError()) { return manufPart; }}
But the this.getAction always returns 'purge'.
Any pointers pls.
Cheers,Zaps.
Hi, Is there a means to get the instance to the version of the item that will become active when a purge is done on a versionable item.
thanks,Zaps
Hi,Tried this but it returns only the latest one and itemcount also returns 1 when it should be 4.
Item versions = this.newItem("part", "get");versions.setProperty("config_id", part.getProperty("config_id"));versions.setAttributeProperty("generation", "condition", "lt " + (Convert.ToInt32(part.getProperty("generation"))-1));versions.setAttribute("orderBy", "generation");versions = versions.apply();
Tried with "where" also but strange that does not return any valueversions.setAttribute("where", "part.generation < 4 and part.config_id = '" + part.getProperty("config_id") + "'");
Any tips please.
zaps.