Sunday, 5 September 2021

D 365 FO New Report or new Design of Existing Report in Print Management

 The simple way to add a new report or new design of an existing report in Print management 



Step-1 Create new class RAM_PurchPurchaseOrderReport


Step-2 Find class PrintMgmtDocType in Application Explore and open in designer 


Step-3 find the delegate in PrintMgmtDocType class Delegate name is  getDefaultReportFormatDelegate



Step-4 Subscribe to the event of the above-highlighted event in the newly created class


Step-5 Now add your report design in the RAM_EventHandlerResult_PrintManagement


[SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
    public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
    {
        if(PrintMgmtDocumentType::PurchPurchaseOrderConfirmation ==_docType)
        {
            _result.result(ssrsReportStr(RAM_PurchPuchaseOrder,Report));

        }

      
    }


Step-6 Perform build and sync and verify on D365FO


Keep Daxing :)


Tuesday, 31 August 2021

Dynamics 365 FO deploy SSRS reports through Windows PowerShell

 In this blog, by using the below script we'll deploy SSRS reports in Microsoft Dynamics 365 Finance and Operations using Windows PowerShell  


Open Windows PowerShell in administrator mode and run the below script.

cd C:\AOSService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\

 

.\DeployAllReportsToSsrs.ps1

For online Cloud-hosted Dev VM, we will run below script

cd [AOS Direcotory]:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\

 

.\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "[AOS Direcotory]:\AosService\PackagesLocalDirectory"

While executing the command you’ll see the below window.



After successfully deploying all the reports you'll see the result and status of each report deployment on the same window



Keep Daxing :)

Sunday, 29 August 2021

D 365 FO Form Data source field Lookup

The below code will help you to create a lookup method for the Form Level Datasource field.

1) go to Form Open the Datasource where you want to add the Lookup select the Field to expand the property under method go to Override method and then select lookup method.

2) After selecting that it will create a method and you can copy-paste the below code inside the method.

3) Change the Tabke and condition according to your requirements. (Here for the demo I'm using Customer details CustTable).


public void lookup(FormControl _formControl, str _filterStr)

            {

                Query                   query = new Query();

                QueryBuildDataSource    queryBuildDataSource;

                SysTableLookup          sysTableLookup;


                sysTableLookup = SysTableLookup::newParameters(tableNum(EcoResProduct), _formControl);

                queryBuildDataSource = query.addDataSource(tableNum(EcoResProduct));

                                     queryBuildDataSource.addRange(ProductType).value(enum2Str(EcoResProductType::Service));


                sysTableLookup.addLookupField(fieldNum(EcoResProduct, Displayproductnumber));

                sysTableLookup.addLookupField(fieldNum(EcoResProduct, SearchName));

                sysTableLookup.addLookupField(fieldNum(EcoResProduct, ItemClassification));


                sysTableLookup.parmQuery(query);

                sysTableLookup.performFormLookup();

            }







Thanks

Keep Daxing :)

Tuesday, 24 August 2021

D 365 FO Dialog Confirmation Box

Below is the line code that will help you to ask the confirmation from the user before executing the actual logic.


            if (box::yesNo('[Confirmarion message]', dialogButton::Yes, "Confirm changes") == dialogButton::Yes)

            {

                info(strFmt("Yes"));

//Your Logic if your select the Confirmaiton message Yes

            }



Thank you

Keep Daxing :)

Tuesday, 10 August 2021

D 365 FO / Ax 2012 /2009 X++ code to find the Logged in Worker details

Hi all,

Below is the line of code that will help you to get the Logged in employee details is he mapped with User in the Userinfo Form.



                 HcmWorker hcmWorker;

                hcmWorker = hcmWorker::find(DirPersonUser::findUserWorkerReference(curUserId()));

                info(strFmt("Current Worker name is : %1 ",hcmWorker.name()));




Thank you

Keep Daxing :)