Thursday, June 25, 2020

Fulll Build error in D365 Finance - "The name 'IConfigurationService' does not denote a class, a table, or an extended data type"

Some times we will get build error "The name 'IConfigurationService' does not denote a class, a table, or an extended data type" from the class ERSolutionGlobalRepositoryCache. This class belongs to model "ElectronicReporting". If we have the reference to this model also we will encounter this error.



To resolve this issue, first build the ElectronicReporting model alone. After successful ElectronicReporting model build, the full build will be successful.

Friday, April 24, 2020

Get sales price from trade agreements in D365 F&O via X++

Below is the code to get sales price from trade agreements in D365 F&O via X++.


    SalesPrice      price;
    InventDim       inventDim;
    PriceDisc       priceDisc;
    InventTable     inventTable = InventTable::find('A0001');
    CustTable       custTable   = CustTable::find('US-001');
  
    inventDim.InventSiteId      = '1';
    inventDim.InventLocationId  = '11';
    inventDim.wMSLocationId  = '11';
    inventDim = InventDim::findOrCreate(inventDim);

    PriceDiscParameters parameters =  PriceDiscParameters::construct();
    parameters.parmAccountNum(custTable.AccountNum);
    parameters.parmCurrencyCode(custTable.Currency);
    parameters.parmInventDim(inventDim);
    parameters.parmItemId(inventTable.itemid);
    parameters.parmModuleType(ModuleInventPurchSales::Sales);
    parameters.parmPriceDiscDate(systemDateGet());
    parameters.parmQty(1);
    parameters.parmUnitID('pcs');;


    priceDisc = PriceDisc::newFromPriceDiscParameters(parameters);
      
    if(priceDisc.findPrice(custTable.PriceGroup,false))
    {
        price = priceDisc.price();
    }
    info (strFmt("Price = %1", price));


Thursday, April 2, 2020

"Object reference not set to an instance of an object" error while saving changes to an object in D365 F&O

Some times we receive error like "Object reference not set to an instance of an object" while saving changes to an object in VS.

To get rid of this error right click on the object which causes the issue and select Exclude From Project.  Then add the object again from AOT to the Project.

Thursday, May 30, 2019

AX 2012 VAT HMRC integration error "HMRC service returned error code 406"

When we try to retrieve VAT obligations we will end up with an error "HMRC service returned error code 406".

We need to change the below code.

Add the below code in RetailCommonWebAPI class

        if (strLen(_request.parmAcceptEncoding()) > 0)
        {
            headers.Add(_request.parmAcceptEncoding());
        }

        if (strLen(_request.parmAccept()) > 0)
        {
            request.set_Accept(_request.parmAccept());
        }

and 
        this.initRequestClientCertificates(_request.parmClientCertificates(), request);