Search code examples
acumatica

make a tab disappear by code c# / or action disabled


I would like to make the activity tab disappear from the code (condition caseClassid)... Not having succeeded, I tried to make the actions inactive, I don't have any errors but it doesn't work, the screen is the CR306000, thank you ! Xavier FFY

      public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
      {
        #region Event Handlers
    
        protected void CRCase_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
          
          var row = (CRCase)e.Row;
          if (row == null) return;
          Boolean xm_valfinale=true;
    
          if ((row.CaseClassID=="F") ||(row.CaseClassID=="D"))
          {
            xm_valfinale=false;
            PXUIFieldAttribute.SetWarning<CRCase.subject>(cache, row, "Il est nécessaire de renseigner la bonne famille !");  
          }     
            Base.Activities.AllowInsert = xm_valfinale;
            Base.Activities.AllowUpdate = xm_valfinale;
            Base.Activities.AllowDelete = xm_valfinale;
        }   
    }

Solution

  • You need to use

    Base.Activities.AllowSelect = xm_valfinale;
    

    And on the PXTabItem in the ASPX, set

    RepaintOnDemand="false"