Posts

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

Adding Symbol Font Icons to a Grid in Dynamics 365

Image
Adding a symbol icon on a grid can be a useful way to provide information to end users and to make the information a bit more visually appealing.   To do this, first select a symbol you want from the relevant symbol font, which can be found at the link below. This is also useful to keep track of new and changing symbols in every new version . Add some fields and create a new “Image” control on the grid. We will now create a display method that can be used from the LogisticsPostalAddress DataSource. We don’t want to overlay the table, we want to extend it. To do this, create a final class with a name that ends in “_Extension”. Decorate it with the “ExtensionOf” attribute so that the compiler can handle it.  We are going to create a display method that returns a container. Here’s the sample code: [ ExtensionOf ( tableStr ( PurchLine ))] public static class  SMJSalesLine_Extension { [ SysClientCacheDataMethodAttribute ( true )]   public static display

What exactly does executeQuery() do?

                   On a form level you have datasource, one or more. You build a query specifying relations between them. Executequery executes this query to get data from underlying tables and show it on a form. executeQuery method is executed when a form is opened for data display. The executeQuery method can be overridden on a form data source by right-clicking the Methods node under the data source, pointing to Override Method, and then clicking executeQuery. Examples:            The following example executes a data source query. public void executeQuery() {   this .query().dataSourceNo( 1 ).clearRanges();    if (CityCode.valueStr() != "" )   {       QueryBuildRange qbrCityCode;      qbrCityCode = this .query().dataSourceNo( 1 ).addRange( fieldNum (SMJ_CandidateDetails,CityCode));      qbrCityCode.value(CityCode.valueStr());    }     super ();  }

SSRS Report using Controller , Contract and RDP classes in D365

Image
STEP 1 : Create new TEMP table STEP 2 : Create query. STEP 3 : Create a Contract class [DataContractAttribute] class SMJ_PerdiemContract {     PerdiemStatus    perdiemstatus;     [DataMemberAttribute(identifierStr(PerdiemStatus)),         SysOperationLabelAttribute ("Perdiem status"),         SysOperationHelpTextAttribute("Perdiem status"),         SysOperationDisplayOrderAttribute("1")]         public PerdiemStatus parmPerdiemStatus(PerdiemStatus _PerdiemStatus = perdiemstatus)     {         perdiemstatus = _PerdiemStatus;         return perdiemstatus;     } } STEP 4 : Create a DP class: [SRSReportQueryAttribute(queryStr(SMJ_PerdiemReport)), // query  SRSReportParameterAttribute(classStr(SMJ_PerdiemContract))]// contract class     public class SMJ_PerdiemDP extends SRSReportDataProviderBase {     SMJ_PerdiemTableTempDB  perdiemTableTempDB;     PerdiemStatus           perdiemStatus;        PerdiemRequestID        PerdiemRequ