Posts

Showing posts with the label Hide selected ENUM values

Hide Enum value based on condition at run time (bounded)

Image
                Here is code sample to hide ENUM elements from a FORM at run time.   For reference purpose I’m using leave request process form. In this every worker have different type of leaves for example, some worker can able to apply EL some of can eligible to apply EL women worker only eligible to apply ML. So we supposed to modified ENUM value based on worker. (ENUM = SMJ_LeaveCode) Now i want to show only first two values while selecting on SO, to achieve this override the form control method as below [Control( "ComboBox" )]     class SMJ_LeaveRequestLine_TypeOfleave     {         /// <summary>         ///         /// </summary>         public void enter()         {             super ();              hcmworker CheckLeaveType = hcmworker ::findByPersonnelNumber( hcmworker ::find( hcmworker ::userId2Worker(curUserId())).PersonnelNumber);// this is for get current logged in worker id                 i

Hide selected ENUM values in form control using X++ code(this is only applicable for the unbounded field control)

Image
              Remove some of the elements that are not needed when shown in a combo-box on a form. To achieve this behaviour Microsoft has given a class just for that purpose. The class is “SysFormEnumComboBox”. override the init() of the form and add the code.   public void init()     {         SysFormEnumComboBox      sysFormEnumComboBox;         Set enumSet = new Set ( Types ::Enum); // collection of selected values.         if (CheckLeave.SMJ_CL == NoYes ::Yes)             enumSet.add( SMJ_LeaveCode ::CL);         if (CheckLeave.SMJ_EL == NoYes ::Yes)             enumSet.add( SMJ_LeaveCode ::EL);         if (CheckLeave.SMJ_ML == NoYes ::Yes)             enumSet.add( SMJ_LeaveCode ::ML);         if (CheckLeave.SMJ_Others == NoYes ::Yes)             enumSet.add( SMJ_LeaveCode ::Others);         if (CheckLeave.SMJ_SL == NoYes ::Yes)             enumSet.add( SMJ_LeaveCode ::SL);         SysFormEnumComboBox = SysFormEnumComboBox ::newParameters( el