Wednesday, February 21, 2018

Important Ebooks for Microsoft Dynamics 365 FO

Hi folks,


Microsoft Dynamics 365 Finance and Operations is shifting to a totally new paradigm  and we need to be aware of the patterns and trends included in this massive shift.


So here are few books for all of you which might help you a little.

Click on the below links or copy and paste it in your address bar.


1) Implementing Microsoft Dynamics 365 Finance and Operations

    https://drive.google.com/file/d/1pCYbQCxVE6z_r9mmR9NIl794sJxP_u43/view?usp=sharing


2) Microsoft Dynamics 365 for Finance and Operations Development Cookbook

    https://drive.google.com/file/d/1TuFa0SJYq7kxbH6cYW7pCNQ1_OS7HsON/view?usp=sharing


3) Extending Microsoft Dynamics 365 Finance and Operations

    https://drive.google.com/file/d/15hbtwl5B9ND2CQ9TBwVSw3NVsDStGEgQ/view?usp=sharing



   Happy Learning!!!!

Monday, February 12, 2018

How to access Table Buffer through Web Url in D365 FO


Traditionally the procedure of accessing a Table Buffer was very simple but as the evolution happened from Standard AX 2012 to Dynamics 365 Operations various ways came into existence such as accessing a Table Browser from Web URL.


Technically even here you can go to Application Explorer and access your desired Table Browser but sometimes it shows an error like given below in Point No 2.


1) Accessing a Table Browser now















2) Error is shown :-














So the simple solution is accessing the Table Browser by writing this url in the address bar and then lets see the result :-


https://usnconeboxax1aos.cloud.onebox.dynamics.com/?mi=SysTableBrowser&prt=initial&cmp=USMF&tablename=MyTable&limitednav=true



Et Voila!!!!











Sunday, February 11, 2018

How to import Data From Excel into an AX Table using x++ in D365 FO

A very basic functionality needed nowadays to import data from Microsoft Excel but the way X++ has been redesigned including all the new functions for immense operations.
Now the SysExcelApplication and all other classes for Excel with "Sys" prefix is not used now.

Let's see how it gets worked out now :-



Step 1 :-  In your Dynamics 365 Operations Project. Add a new Class :-





Step 2 :-  Name your class























Step 3 :- Write the following code :-


class ImportExcelData extends RunBase
{
    str fileUrl;
    MyTable     myTb;
 
    public Object dialog()
    {
     
        Object                  dialog;

        FormBuildButtonControl    buttonControl;

        DialogGroup                    dlgGroup;

        FormBuildGroupControl    buttonGroup;

     

        dialog = super();

           

        dlgGroup       = dialog.addGroup('');

        buttonGroup    = dialog.formBuildDesign().control(dlgGroup.formBuildGroup().id());

        buttonControl  = buttonGroup.addControl(FormControlType::Button, 'Upload');

        buttonControl.text("Upload file");



        buttonControl.registerOverrideMethod(methodStr(FormButtonControl, clicked),

                                        methodStr(ImportExcelData , uploadClickedEvent),

                                        this);

        return dialog;
    }

    private void uploadClickedEvent(FormButtonControl _formButtonControl)

    {
     
        FileUploadTemporaryStorageResult result = File::GetFileFromUser() as FileUploadTemporaryStorageResult;

        if (result && result.getUploadStatus())

        {

            result.getFileContentType();

            fileUrl = result.getDownloadUrl();

        }

    }

    public container  readExcelData(System.IO.Stream      _stream)

    {
        container conRow,conData;
        OfficeOpenXml.ExcelWorksheet _worksheet;

        OfficeOpenXml.ExcelPackage package = new OfficeOpenXml.ExcelPackage(_stream);

        int iRowCount,iCellCount;

        anytype        anyData;

     

        try

        {

            if(package)

            {

                _worksheet = package.get_Workbook().get_Worksheets().Copy("Sheet1","ABC");

                var cells = _worksheet.get_Cells();

                iRowCount = _worksheet.get_Dimension().get_End().get_Row();



                iCellCount = _worksheet.get_Dimension().get_End().get_Column();



                for (int i=2;i<=iRowCount;i++)

                {

                    conRow = conNull();

                    for (int j=1;j<=iCellCount;j++)

                    {

                        anyData= cells.get_Item(i, j).get_Value();

                        if(!anyData && j ==1)

                           break;



                        if(anyData)

                           conRow += anyData;

                        else

                           conRow += "";

                     

                    }

                    if(conRow)

                    {

                        conRow += iRowCount;

                        conData = conIns(conData,i,conRow);

                    }

                 
                    myTb.Field1=cells.get_Item(i, 1).get_Value();
                    myTb.Field2=cells.get_Item(i, 2).get_Value();
                    myTb.Field3=cells.get_Item(i, 3).get_Value();
                    myTb.Field4=cells.get_Item(i, 4).get_Value();
                    myTb.Field5=cells.get_Item(i, 5).get_Value();
                    myTb.insert();
                 
                 
                     

                }
             
         
             

            }

         

        }

        catch (Exception::CLRError)

        {

            throw error("@SYS135884");

        }

        return conData;

    }

    Public  void   run()

    {

        System.Byte[] byteArray;

        System.IO.Stream     stream;

        try

        {

            stream = File::UseFileFromURL(fileUrl);

            this. readExcelData(stream);

            //info("Done");

        }

        catch(Exception::Error)

        {

            info(strFmt("%1 %2",Exception::Error,fileUrl));

        }

    }

    public static void main(Args args)
    {
        ImportExcelData objimport=new ImportExcelData();

        if(objimport.prompt())
        {
            objimport.run();
        }
    }

}

How to reverse Free Text Invoice Voucher entries without Dialog

 Hey Folks ,  This blog post is in continuation of the previous post for Reversing Free Text Invoice Voucher entries with Dialog. Only diffe...