} // addStatistics /// <summary> /// After Save /// </summary> /// <param name="newRecord">new</param> /// <param name="success">success</param> /// <returns>success</returns> protected override bool AfterSave(bool newRecord, bool success) { if (newRecord) // Add to all automatic roles { MRole[] roles = MRole.GetOf(GetCtx(), "IsManual='N'"); MProcessAccess pa; for (int i = 0; i < roles.Length; i++) { pa = new MProcessAccess(this, roles[i].GetAD_Role_ID()); pa.Save(); pa = null; } } // Menu/Workflow else if (Is_ValueChanged("IsActive") || Is_ValueChanged("Name") || Is_ValueChanged("Description") || Is_ValueChanged("Help")) { MMenu[] menues = MMenu.Get(GetCtx(), "AD_Process_ID=" + GetAD_Process_ID()); for (int i = 0; i < menues.Length; i++) { menues[i].SetIsActive(IsActive()); menues[i].SetName(GetName()); menues[i].SetDescription(GetDescription()); menues[i].Save(); } X_AD_WF_Node[] nodes = MWindow.GetWFNodes(GetCtx(), "AD_Process_ID=" + GetAD_Process_ID()); for (int i = 0; i < nodes.Length; i++) { bool changed = false; if (nodes[i].IsActive() != IsActive()) { nodes[i].SetIsActive(IsActive()); changed = true; } if (nodes[i].IsCentrallyMaintained()) { nodes[i].SetName(GetName()); nodes[i].SetDescription(GetDescription()); nodes[i].SetHelp(GetHelp()); changed = true; } if (changed) { nodes[i].Save(); } } } return(success); }