Wednesday, December 1, 2021

How to call standard button Clicked method from customized button in D365FO

Hi Guy's,

Recently, I received one requirement where we need standard button clicked method logic to be called from customized button on the same form but in another Action Pane Tab and button group.

To achieve this requirement, I used COC of the form and retrieve the button control in variable. I easily able to call the method's define on the button.

Please check below code.

[ExtensionOf(formStr(WHSLoadTable))]
final class WHSLoadTableForm_Extension
{

[FormControlEventHandler(formControlStr(WHSLoadTable, PickList), FormControlEventType::Clicked)]
public static void PickList_OnClicked(FormControl sender, FormControlEventArgs e)
{
        FormButtonControl callerButton = sender as FormButtonControl;

                  FormRun form = callerButton.formRun();

                  FormButtonControl btnPickList = form.design(0).controlName("WHSPickListShipping") as                 FormButtonControl;

                btnPickList.clicked();

        }
}

Happy Learning !!

Friday, September 3, 2021

Unable to find the report design reportName.DesignName in D365FO

 

 D365FO - Report error -

Unable to find the report design reportName.DesignName


 

If the report is not deployed on the server and you try to run the report from the front end then you will receive the error as ‘Unable to find the report design reportName.DesignName.

Go to Visual Studio and deploy the report and recheck the report from the front end.

Friday, December 20, 2019

AOS service not starting | SYSTIMEZONESVERSION

After installation of AOS, Service couldn't started due to systemtimezoneversion missmatch. Error is as below -

Error message: "The internal time zone version number stored in the database is higher than the version supported by the kernel (11/8). Use a newer Microsoft Dynamics AX kernel."

Resolution :
SELECT * FROM SQLSYSTEMVARIABLES where parm ='SYSTIMEZONESVERSION';
--Result is 11
Update SQLSYSTEMVARIABLES set value=7 where parm='SYSTIMEZONESVERSION';
--update it to 8

Thursday, September 26, 2019

Update cross reference in batch job - AX 2012 R2, R3

Below is the code snippets to update cross references of all AOT objects through batch job.

static void UpdateCrossRefBatch(Args _args)
{
   ;
   xRefUpdate::truncateXrefTables();
   xRefUpdateIL::updateAllXref(true, false, true);
   info("Done, cross reference update batch job created.");
}

Batch job will get added with the description as "Update xref for complete AOT" .

Happy Daxing !!

Thursday, May 31, 2018

Add display method to List page (VendTableListPage) AX 2012

Hi Experts,

As per requirement of client, PAN number should be display on vendor list page. I have created a display method on VendTable and added to vendTableListPage design


display PANNumber_IN getVendPANNumber()
{
    TaxInformationVendTable_IN      taxInformationVendtable_IN;

    select firstOnly PANNumber from taxInformationVendtable_IN
        where taxInformationVendtable_IN.VendTable == this.AccountNum;

    return taxInformationVendtable_IN.PANNumber;
}



After adding fields on Design, Save and compile the form.
**Most Important**
Go to the front end i.e. AX Client, Accounts Payable/ Vendors, the vendor list page form will open, Right click on form then Click on Reset button. After this you have to close the form and reopen again.

Thursday, March 15, 2018

Test Data Transfer tool

1. Download Test Data Transfer Tool
2. Install it on Database server
3. Import MetadataGenerator.XPO in Source AX application. (From where you want to export data)
4. Run job MetadataGenerator and find the  Metadata file
5. Paste Metadata file into [Lists] folder. ( check your installation path in DB server)  it will be like "C:\Program Files (x86)\Microsoft Dynamics AX 2012 Test Data Transfer Tool (Beta)\[Lists]"
6. To export data from specific company, open SQL Sever management studio and select your source database. Right click and new query. Copy paste below given code into query window. Replace your company name. (Company Name highlighted in bold font). Run the script and copy ouput.
7. Create new text file and paste query output. Save this file with name Filters.xml
8. Put Filters.xml file into [Lists] folder (Path given in step 5)
9. Open command prompt with Run as administrator.
10. Brows the path of DP.exe ("C:\Program Files (x86)\Microsoft Dynamics AX 2012 Test Data Transfer Tool (Beta)")
11.  Enter below command and hit enter.
DP.exe  Export "D:\Exported Data"  MicrosoftDynamicsAX  AXDBServerName

Filters.xml file content is as below.

-- Declare the variables to store the values returned by FETCH.
DECLARE @tableName varchar(100);
DECLARE @fieldName varchar(100);
SET @fieldName = 'DataAreaID';

DECLARE table_cursor CURSOR FOR
SELECT  Name FROM sys.tables ORDER BY Name;

OPEN table_cursor;

-- Perform the first fetch and store the values in variables. 
PRINT '<tables>'
FETCH NEXT FROM table_cursor
INTO @tableName;

-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- All tables don't have DataAreaId field, So check first that table is having dataareaid filed and then
-- add tableName to xml
IF COL_LENGTH(@tableName, @fieldName) IS NOT NULL
BEGIN
-- Concatenate and display the current values in the variables.
PRINT '<table name="' + @tableName +'"><filter><field>DataAreaID</field>=''USMF''</filter></table>'-- + @tableName --+ ' ' +  @LastName
END
-- This is executed as long as the previous fetch succeeds.
   FETCH NEXT FROM table_cursor
   INTO @tableName;
END
CLOSE table_cursor;
PRINT '</tables>'
DEALLOCATE table_cursor;
GO