28 May’15

Dynamics AXConfigure Inbound Port in AX 2012 to handle Bigger size XML coming inside via AIF

1. The maximum size of the XML message that AX can receive is 64kb. In order to accept the XML of bigger size, we have to configure the Inbound port.

 

2. The web.config is created from the configuration of the inbound port. So, in order to preserve the changes even if the Inbound port gets reactivated, please make the changes as detailed below [Please refer to the below snapshots for your information]

a. Go to the Inbound port.

b. De-Activate the inbound port.

c. Click on “Configure” button as shown below [A pop up window will come]

d. Click “Yes” on the window popped up[Find below the snapshot of the popped up window]

e. Now go to Bindings basicHttpBindingWithWindowsAuth as highlighted in the below snapshot.

f. Now set the size of the property “MaxReceivedMessageSize” to a bigger value(like: 10485760).

g. Save the changes and close the form.

h. Click on Activate button to activate the Inbound port.

i. Check the Web Config file from the above file location and verify the value that was set in the previous “step-f”.

X++ code to fetch the data from Excel in AX 2012R2

I have come across the requirement to fetch the data from Excel in AX.
Below is the X++ code to do the same:

static void ImportDataFromExcel(Args _args)
{
    SysExcelApplication application;
    SysExcelWorkbooks workbooks;
    SysExcelWorkbook workbook;
    SysExcelWorksheets worksheets;
    SysExcelWorksheet worksheet;
    SysExcelCells cells;
    COMVariantType type;
    int row;
    ItemId itemid;
    Name name;
    FilenameOpen                    filename;
    dialogField                     dialogFilename;
    Dialog                          dialog;

    ;
    #AviFiles
    #Excel
    application = SysExcelApplication::construct();
    workbooks = application.workbooks();
 
    dialog = new Dialog("ExcelUpload");
    dialogFilename      =   dialog.addField(extendedTypeStr(FilenameOpen));
    dialog.filenameLookupFilter(["@SYS28576",#XLS, "@SYS28576",#XLSX]);
    dialog.filenameLookupTitle("Upload from Excel");
    dialog.caption("Excel Upload");
    dialogFilename.value(filename);

    if(!dialog.run())
        return;


    filename            =   dialogFilename.value();
    application         =   SysExcelApplication::construct();
    workbooks           =   application.workbooks();
    try
    {
    workbooks.open(filename);
    }
    catch (Exception::Error)
    {
    throw error("File cannot be opened.");
    }

    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
 
 do
{
row++;
itemId = cells.item(row, 1).value().bStr();
type = cells.item(row, 1).value().variantType();
info(strfmt('%1', itemId));
}
while (type != COMVariantType::VT_EMPTY);
}
Written by

Team Member

CloudFronts

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Reading more then 10K records in D3FOE OData API

    11 July’ 2018

    Introduction: We all know Dynamics 365 Finance and Operations has limitation of 10K records to be fetched at a time usi...

    Read more
  • Paging in D365 Customer Engagement v9.0

    10 July’ 2018

    Introduction: The Xrm.retrieveMultipleRecords method is used to retrieve a collection of records in Dynamics 365 Custom...

    Read more
  • Set up Dynamics 365 connection in Microsoft Social Engagement

    10 July’ 2018

    Introduction: This blog explains how to Set up Dynamics 365 connection in Microsoft Social Engagement. Steps to be follo...

    Read more
  • Voice of the Customer failed to install

    10 July’ 2018

    Introduction: Many people face issues in installing Voice of Customer solution on v9 environment and trying repeatedly ...

    Read more
  • Scribe Insight AX as a Web Service Find Block issue

    10 July’ 2018

    Introduction: If we need to look up for any value from AX then we do it by using a Find Block in Scribe Insight Eg: Basi...

    Read more