Forum Discussion
jtensmeyer
7 years agoIdeator I
Hello Sudarshan and Angela,
Thank you for this discussion. I have been trying to do something very similar. I implemented the state variable method in the OnBeforeUpdate event as you described but I am still not seeing the changes on the newly created generation of the part. I have verified in the debugger that it does go through the logic of finding the set state variable and the variable has the right value in it and that the id of the part is the correct one (the new generation). However, the property changes do not show up. If I change the action to "edit" I get an "ItemIsNotLocked" exception. Any idea what I might be doing wrong?
Thanks,
John Tensmeyer
// Called OnBeforeUpdate for Parts and Documents. string setRev= (string)RequestState["set_MinRev"]; // this logic will only applied if the variable is available in session state if (!string.IsNullOrEmpty(setRev)) { Item myPart = this.newItem(this.getType(), "edit"); myPart.setProperty("ws_minor_rev", setRev); myPart.setProperty("name","goober"); string newID = this.getID(); myPart.setID(newID); myPart.setAttribute("version","0"); myPart.setAttribute("serverEvents","0"); myPart = myPart.apply(); if (myPart.isError()) return myPart; } return this;