This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - User Saved Previous Generation

jsnosal - Tuesday, November 5, 2013 3:07 PM:

A user saved a previous generation on accident. The assembly has gone through an ECO to get released. Its also a sub-BoM to multiple BoMs. Has anyone else had this issue and how did you go about fixing it? Is there a way to not allow a user to save a previous generation if the BoM has been released?

I have tried to run an ECO to set the preliminary state back to released. I get an error saying that it can't be released, since it was released on a previous ECO. 

I tried using the AML promoteItem but I got the same error as above.

I was going to delete the assembly off its parent BoMs. The parent BoMs create a new generation and store the previous generation. 

Thank you for your help. 



zahar - Tuesday, November 5, 2013 4:02 PM:

We have found this issue during 9.3.0 implementation too. 

What you can do to prevent user to lock old generation is add server Method on beforeLock of part with following code:

 

Innovator inn = this.getInnovator();

Item myItem = inn.newItem(this.getType(),"get");

myItem.setID(this.getID());

myItem.setAttribute("select","is_current");

myItem=myItem.apply();

 

if (myItem.isError())

{

return myItem;

}

 

if (myItem.getProperty("is_current","") != "1")

{

String listOfIdentities=Aras.Server.Security.Permissions.Current.IdentitiesList; 

Item requestForIdentities = inn.newItem("Identity", "get"); 

    requestForIdentities.setProperty("id", listOfIdentities); 

    requestForIdentities.setPropertyCondition("id", "in"); 

    requestForIdentities.setAttribute("select", "name"); 

    requestForIdentities.setProperty("is_alias","0"); 

    requestForIdentities.setPropertyCondition("is_alias", "eq"); 

    requestForIdentities.setProperty("name","'Aras PLM'");

    requestForIdentities.setPropertyCondition("name", "in"); 

    Item identities = requestForIdentities.apply();

    if ((identities.getItemCount() >0) || (inn.getUserID()=="AD30A6D8D3B642F5A2AFED1A4B02BEFA"))

    {

    //User is a Member of Aras PLM or is Super User

    return this;

    }

    else

    {

    //Item is not current and user is not ArasPLM or Super User

    return inn.newError("The version of the Item you are trying to lock is not current.  Please lock the current version.");

    }

 

}

else

{

//Item is current

return this;

}



jsnosal - Wednesday, November 6, 2013 8:40 AM:

Zahar,

This is a huge help with making sure this situation won't happen again. Thank you for your help.