Posts

Reading CSV/text file from Azure storage blob

Image
 Reading CSV/text file from Azure storage blob Perquisite: 1. Create Azure storage account 2. Blob container 3. Folders inside the blob container 4. CSV file inside the folder 5. Access key How to create Azure storage account? 1. Login on https://portal.azure.com 2. To create storage account click on Storage account 3. Follow the wizard instruction to create storage account 4. Once storage account name created, create container, folder and place file inside folder. click on storage browser 5. Place file inside folder Now we have created Storage account, container, folder and file. 6. How to get storage account access key ? Go to storage account main page --> Security + networking --> Access Keys   Establishing connection between D365 F&O and Azure storage account, reading azure storage file from D365 F&O using X++ 1. Create runnable class -  XXXTestAzureBlob 2. Method to establish connection -  connectToAzureStorageAccountBlob() 3. Reading the stor...

File upload as parameter on batch job parameter

Image
File upload as parameter on batch job parameter: Sometimes at run time, while running batch job we need to execute set of records through batch job. I  my case, I want to update setup of customer details using batch job. So for that I have created batch job and on batch job parameter, I will upload set of customer using file and batch job will update only those uploaded customer details instead of entire customer. Batch job parameter: Objects: 1. Contract class: XXX_CustomerStatmentReportContract [   DataContractAttribute,     SysOperationContractProcessingAttribute(classStr(XXX_CustomerStatmentReportUIBuilder)) ] public class XXX_CustomerStatmentReportContract {     AccountNum  accountNum;     boolean     includeAllCustomer;     container   storageResult;     [DataMemberAttribute,SysOperationLabelAttribute(literalStr("@XXX:CustomerEmailUpdateUpload")),SysOperationDisplayOrderAttribute('2...

Execute X++ objects from D365 F&O UI: Table, form, class, menu item & OData

Execute X++ objects from D365 F&O UI: Table, form, class, menu item & OData Class: https://D365FO base URL/?cmp=CompanyName&mi=SysClassRunner&cls=ClassName   Table: https://D365FO base URL/?cmp=CompanyName&mi=SysTableBrowser &TableName= TableName   Form: https://D365FO base URL/?cmp=CompanyName&f = FormName Note: Form runs  directly  in Development environment whereas this wouldn’t run  directly   in Sandbox and PROD environment. To access form, attach respective form on menu item and run the menu item.   Display menu item: https://D365FO base URL/?cmp=CompanyName&mi = DisplayMenuItemName   Output menu item: https://D365FO base URL/?cmp=CompanyName & mi=Output%3AOutput MenuItemName   Action menu item: https://D365FO base URL/?cmp=CompanyName & mi=Action%3AAction MenuItemName   OData: https://D365FO base URL/data/OData public collection name ODa...

SSRS report using contract class

Image
SSRS report Custom SSRS report development: Requirement:  Create following report design using "Customer number" as parameter.                           Used object: 1. Temp table (if required) 2. Contract class (if required) 3. DP class 4. Controller class 5. Report design 6. Action menu item Temp table:  If report based on custom table, create new temp table(preferably used as inMemory type) otherwise create extension of standard table and add the required extendable field.  Contract class:  Create contract class if report contains any parameter to run the report. In the following example taken customer number as report parameter [DataContractAttribute] public class XXX_CustomerAgingContract {     AccountNum accountNum;     [DataMemberAttribute("Customer number")]     public AccountNum parmCustomerNum(accountNum _accountNum = accountNum)   ...

Custom services - API request and response using X++

Image
Creating custom services: Requirement :  D365 FO Received request from external application, read the request within D365 FO and response back to external application from D365 FO. Request body: {   "_request": {     "SalesId": ["TestSO001", "TestSO002"]   } } Response body: {   "OrderDetails": [     {       "order_number": "TestSO001",       "ShipmentTrack": ["Track-01"]        },     {       "order_number": "TestSO001",       "ShipmentTrack": ["Track-02", "Track-03"]       }   ] } To achieve above request and response JSON, we need to create few contract classes and to communicate external application, we need to create service and service group objects.  AppId and secrets key needs to setup under D365 FO AAD. Request Contract class: [datacontractattribute] public class XYZ_ShipmentRequest {        DataAreaI...

Access form level selected records from another class on button click

Image
 On Form level we have selected multiple records and we wants to access those selected records on button clicked, the below code can be helpfull. Created a form : XXXTestForm Form datasource table : XXXTestTable Created action menu (Linked class: XXXTestClass) and placed on form action pane : XXXTestMenuItem Write below code on form button click [Form] public class TestTestForm extends FormRun {     [Control("MenuFunctionButton")]     class TestMenuItem     {         /// <summary>         ///         /// </summary>         public void clicked()         {             super();             int recordsCount;             XXXTestTable testTable;             container con;             Args args;  ...

Add security role "admin" on user in Dev environment using SQL/X++

Image
Whenever we are trying to restore DB from PROD to dev instance. After DB restore sometimes we don't have admin access in dev instance and we can't access all Dev instance module/data or we don't have super admin access.  To access all module/table/data in dev instance we required Admin role. We can assign admin role using SQL script.  The following script would help us to add admin/any role using SQL Execute following script to know role specific "RecId"     Select Recid , * from SecurityRole where name like 'system%'     Run following script to know what role are assigned to specific user select * from SECURITYUSERROLE where user_ like 'paras%' Here I want to add "System administrator" & "System user" role to user level. Following script will help to add additional role on specific user. insert into SECURITYUSERROLE(SECURITYROLE,USER_, ASSIGNMENTSTATUS,ASSIGNMENTMODE) values (162,'parashuram',1,1) insert into SECURI...

DB restore from PROD to UAT/Sandbox and UAT/Sandbox to Dev box

Image
  DB restore from PROD to Sandbox and  Sandbox  to Dev box   1. PROD to UAT DB restore:       Follow following link to restore DB from PROD to Sandbox        https://parashuramd365fo.blogspot.com/2023/06/refresh-database-from-production.html   2. UAT/Sandbox to Dev box DB restore:      2.1 . Export DB from LCS to the Asset Library           Login LCS - Sand box environment full details page, use Maintain > move database > Select export and start   2.2. This will export DB and stored on asset library. Navigate to the Asset Library > Database Backup > Select uploaded exported backup and save to local folder (Let's supposed save into D://DBBackup/) 2.3.  Prepare for DB import a. Log into the target environment using a RDC b. Download the latest SQL package.exe with the Windows .Net Core zip package Use following link to download and install SQL...