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 :)

Monday, 2 August 2021

D 365 FO X++ Code to duplicate the selected Line from Sales Order

Below is a block of code that we can use for copying the existing sales line or selected SalesLine details on the same SalesOrder or another SalesOrder. Basically is it the same as CopyLine functionality in Sales Order.


                      salesLineUpdate.clear();

                    salesLineUpdate.initFromSalesTable([FromSalesTable]);

                    salesLineUpdate.initFromSalesLine([FromSalesLineTable]);

                   ttsbegin;

                    salesLineUpdate.createLine(NoYes::Yes, // Validate

                    NoYes::Yes, // initFromSalesTable

                    NoYes::Yes, // initFromInventTable

                    NoYes::Yes, // calcInventQty

                    NoYes::Yes, // searchMarkup

                    NoYes::Yes);

                    ttscommit;



thank you 

Keep Daxing :)