I have created a simple method (see below) that generates a part name based on selected values.
This works great when creating and updating a preliminary part as it runs on both "onBeforeAdd" and "OnBeforeUpdate".
However, the problem is that since it runs on OnBeforeUpdate, the ECO Express doesn't work when the ECO-lifecycle is pushed from "Plan Review" to " In Work". (Error: Object reference not set to an instance of an object )
Probably because of the mastodon method "PE_ChangeItemTransition".
Perhaps the part somehow is updated by that method, and my method kicks off because of this (?)
My method is intended/needed to run only when manually creating or modifying a preliminary part.
Any suggestions on how to solve this issue?
I find it strange if I need to fix this in the method "PE_ChangeItemTransition".
(C# Server side "onBeforeAdd" and "OnBeforeUpdate".)
_________________________________________________________________________________________
var Value1 = this.getProperty("classification");
// Check if Screw and add name from selected properties
if (Value1.Contains("Screws"))
{
string mat = this.getProperty("kol_screw_mec_material");
string surf = this.getProperty("kol_screw_surface_treatment");
string thread = this.getProperty("kol_screw_thread_type");
string length = this.getProperty("kol_screw_length");
string type = this.getProperty("kol_screw_type");
string concatVal = "Screw " + type + " " + thread + "x" + length + " " + mat + " " + surf;
this.setProperty("name",concatVal);
}
return this;