Monday, 24 February 2020

How to call external class method in enterprise portal

Today, I will be discussing about how to call external class method in enterprise portal.
There was a requirement in which we need to update some information on updating the vendor account within purchase requisition web page on enterprise portal.

For changing this target i created a new class and added a static method inside it. This class was created with in AX and names as PRTestHelper class.

Class: PRTestHelper
Static Method : updateVendorAccount

Now we need to add override the ondatachanged method of vendor account field in PurchReqLineInfo_ascx_cs. Add following code in the class.

 protected void VendAccount_DataChanged(object sender, AxBoundFieldDataChangedEventArgs e)
{
        this.setupDefaultDimension(true);
       
       
        if (Page.IsPostBack)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                DataSetViewRow row;

                row = this.PurchReqLineDS.GetDataSet().DataSetViews["PurchReqLine"].GetCurrent();
                this.AxSession.AxaptaAdapter.CallStaticClassMethod("PRTestHelper", "updateVendorAccount", row.GetFieldValue("RecId"), row.GetFieldValue("VendAccount"));
                DialogHelper.Close(CloseDialogBehavior.RefreshPage);
            }
        }
       
   }


// Following code is used to call method :  this.AxSession.AxaptaAdapter.CallStaticClassMethod("PRTestHelper", "updateVendorAccount", row.GetFieldValue("RecId"), row.GetFieldValue("VendAccount"));

First parameter is : Class name
Second parameter is : Method name
Third parameter is : RecId of Purchase Requisition line
Fourth parameter is : Vendor account

Note : 3rd and 4th parameter are optional as we are using them to send parameter to static method.

How to find web controls in Enterprise portal (EP)

Today , I will be discussing about the approach through which we can find out the web controls of enterprise portal.

Lets take an example of Purchase Requisition web page in Enterprise portal.

1) Go to Enterprise portal -> Purchase Requisition tab -> Click on one of the Purchase requisition

2) Click on Page tab









3) Click on Edit page drop down and select edit page option.























4) Click on drop arrow and select edit web part. The name within managed content item is web control name.


Dynamics 365 F&O - Changes in financial dimension structure methods as compared to AX 2012

Today , I will be discussing about the changes of methods which are commonly used for financial dimension or ledger dimension development using X++.
There are number of methods which have been moved from DimStorage class to other classes in D365 F&O.
Here is the list of those methods.



Thursday, 9 January 2020

Unable to find w3wp process for debugging in Visual studio

Today, I will be discussing about one of the common issue which i faced while attaching the process for debugging in visual studio for D365 F&O project.

I was quite usual that i was unable to find out w3wp.exe process on Attach process screen in visual studio for debugging. Even though VS was running as administrator and i have marked the check box of show all process.

So, this issue usually occurs because when you install  the visual studio then IIS express is the default web server for web applications projects. That's why you visual studio is not using local IIS for running local applications instead of this it is using IIS express.

Workaround for it : Attach iisexpress.exe process instead of w3wp.exe. 




Adding a dataset lookup on purchase requisition form in EP

Today, I will be discussing about one of the issue which  any one has encountered while adding a lookup on data set and it is not visible in EP specially on Purchase Requisition details form. So I will be sharing here the code snippet which can used to show that data set lookup for any field.

void dataSetLookup(SysDataSetLookup _sysDataSetLookup)
{
     Query      query;
     TableId    lookupTableNum;

     lookuptablenum = tableNum(PurchReqTable);

    _sysDataSetLookup.parmLookupFields(new List(Types::String));
    _sysDataSetLookup.parmLookupFields().addEnd(fieldStr(PurchReqTable,PurchReqId));
    _sysDataSetLookup.parmLookupFields().addEnd(fieldStr(PurchReqTable,TestField1));
    _sysDataSetLookup.parmLookupFields().addEnd(fieldStr(PurchReqTable,PurchReqId));
    _sysDataSetLookup.parmLookupFields().addEnd(fieldStr(PurchReqTable,Originator));
    _sysDataSetLookup.parmSelectField(fieldStr(PurchReqTable,TestField1));

    query = new Query(queryStr (PurchReqTableListPage));
    query.dataSourceNo(1).addRange(fieldNum(PurchReqTable,TestField1type)).value(enum2str(RequisitionType::Type1));
    query.dataSourceNo(1).addRange(fieldNum(PurchReqTable,RequisitionStatus)).value(enum2str(PurchReqRequisitionStatus::Approved));
    query.dataSourceNo(1).addRange(fieldNum(PurchReqTable,BlanketOnHold)).value(enum2str(NoYes::no));

    query.allowCrossCompany(true);

    _sysDataSetLookup.parmQuery(query);
    _sysDataSetLookup.parmDataSet(SysDataSetBuilder::constructLookupDataSet(lookupTableNum).toDataSet());
}

Note : This construct method is quite helpful in showing lookup

Error : A reference to 'Dynamics.AX.SourceDocumentation' is required to compile this module.

Today I will be discussing about one of the common issue which you might face while building the custom model.

Below is the detail description of that issue:

A reference to 'Dynamics.AX.SourceDocumentation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is required to compile this module.

Root cause : One of reference module is missing from your custom model.

Solution : You need to update the model by using the model parameter wizard,. Go to Dynamics 365 -> Model management -> Update model parameters -> Select your model -> Check mark the  source documentation module as reference.



Custom Business events Part 3 - (Activate custom business event) in D365 F&O

 In this blog we will discuss about the steps to activate a custom business in D365 F&O. As we know that business event catalog does not...