Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Sunday, June 1, 2014

Appreciate to Microsoft developers for un-imaginable very easy concept in Dynamic AX - Complete intitialization, condition & incrementation as datasource in Dynamic AX

Hi,

Ref:
Form vendInvoiceJournal
method:printTaxUnrealizedInvoice


Here initialization as first record in the data source;
condition as complete data source;
increment as next record in the data source;

    for (vendInvoiceJourLocal = getFirstSelection(vendInvoiceJour_ds);
         vendInvoiceJourLocal;
         vendInvoiceJourLocal = vendInvoiceJour_ds.getNext())

//Brilliant Microsoft developer developed above syntax- but very simple which we cant imagine on normal

Regards,

Job to creating Employee / or upload employee in Dynamic AX

Hi,

Use below code as method to your class that fetches the workbook and pass the values as container to the below method.

private void  EmployeeImportOrCreate(container _c)
        {
            HcmWorkerImportService                      hcmWorkerImportService;
            HcmWorkerImport                             hcmWorkerImport;
            HcmWorkerImport_HcmWorker                   hcmWorkerImport_HcmWorker;
            HcmWorkerImport_DirPerson_DirPerson         hcmWorkerImport_DirPerson_DirPerson;
            HcmWorkerImport_HcmPersonPrivateDetails     hcmWorkerImport_HcmPersonPrivateDetails;
            HcmWorkerImport_DirPersonName               hcmWorkerImport_DirPersonName;
            HcmWorkerImport_DirPartyPostalAddressVie    hcmWorkerImport_DirPartyPostalAddressVie;

            HcmWorkerImport_HcmEmployment               hcmWorkerImport_HcmEmployment;
            HcmWorkerImport_HcmEmploymentDetail         hcmWorkerImport_HcmEmploymentDetail;
            HcmWorkerImport_HcmWorkerTitle              hcmWorkerImport_HcmWorkerTitle;
            ;
            // Create EMP ID personnel Number ...
            hcmWorkerImportService          = HcmWorkerImportService::construct();
            hcmWorkerImport                 = new HcmWorkerImport();
            hcmWorkerImport_HcmWorker       = hcmWorkerImport.createHcmWorker().addNew();
            hcmWorkerImport_HcmWorker.parmPersonnelNumber(conpeek(_c, EmployeeNumber));

            hcmWorkerImport_DirPerson_DirPerson = hcmWorkerImport_HcmWorker.createDirPerson().addNew();
            hcmWorkerImport_DirPerson_DirPerson.parmInitials(conpeek(_c, Initials));
            hcmWorkerImport_DirPerson_DirPerson.parmProfessionalTitle(conpeek(_c, Position));
            // For his name first / middle / last name...
            hcmWorkerImport_DirPersonName       = hcmWorkerImport_DirPerson_DirPerson.createDirPersonName().addNew();
            hcmWorkerImport_DirPersonName.parmFirstName(conpeek(_c, FirstName));
            hcmWorkerImport_DirPersonName.parmMiddleName(conpeek(_c, MiddleName));
            hcmWorkerImport_DirPersonName.parmLastName(conpeek(_c, LastName));
            //For his Birth date and Gender...
            hcmWorkerImport_HcmPersonPrivateDetails = hcmWorkerImport_DirPerson_DirPerson.createHcmPersonPrivateDetails().addNew();
            hcmWorkerImport_HcmPersonPrivateDetails.parmBirthDate(HrmImportEmployeeMasterdata::convDate(conpeek(_c, BirthDate)));
            hcmWorkerImport_HcmPersonPrivateDetails.parmGender(HrmImportEmployeeMasterdata::convGender(conpeek(_c, Gender)));
            //Address pf the worker related information...
            hcmWorkerImport_DirPartyPostalAddressVie = hcmWorkerImport_DirPerson_DirPerson.createDirPartyPostalAddressView().addNew();
            hcmWorkerImport_DirPartyPostalAddressVie.parmCountryRegionId(HrmImportEmployeeMasterdata::defaultCountryRegionId());
            hcmWorkerImport_DirPartyPostalAddressVie.parmRoles(HrmImportEmployeeMasterdata::defaultRole());
            hcmWorkerImport_DirPartyPostalAddressVie.parmStreet(conpeek(_c, Address));
            hcmWorkerImport_DirPartyPostalAddressVie.parmStreetNumber(conpeek(_c, streetnum)));
            hcmWorkerImport_DirPartyPostalAddressVie.parmZipCode(conpeek(_c, PostalCode));
            // Releasin to company address book but here this code add the cur3eest worker to current address book
            hcmWorkerImport_HcmEmployment   = hcmWorkerImport_HcmWorker.createHcmEmployment().addNew();
            hcmWorkerImport_HcmEmployment.parmLegalEntity(curext());

            hcmWorkerImport_HcmEmploymentDetail = hcmWorkerImport_HcmEmployment.createHcmEmploymentDetail().addNew();
            hcmWorkerImport_HcmEmploymentDetail.parmWorkerStartDate(
                                            datetobeginUtcDateTime(
                                            HrmImportEmployeeMasterdata::convDate(conpeek(_c, DateOfHiring)),
                                            DateTimeUtil::getUserPreferredTimeZone()));
            //Creation completion
            hcmWorkerImportService.create(hcmWorkerImport);

        }

Regards,

Basic table information in Dynamic AX

Hi,

Table name Information
HcmWorker Employee information
CustTable Customer information
PurchTable Purchase related information
EcoresProduct  Product information
InventTable Item information (released products)
SalesTable Sales information
VendTable  Vendor information
ProjTable Project information
Retail* All the retail related information table starts with retail as prefix
UserInfo User information
All the above tables are master table so the bears lines table / multiple lines tables

Regards,

Friday, May 30, 2014

Expression to get full company name in SSRS

Hi,

=Microsoft.Dynamics.Framework.Reports.DataMethodUtility.GetFullCompanyNameForUser( Parameters!AX_CompanyName.Value,Parameters!AX_UserContext.Value)

Regards,

Expression to get only system date in SSRS

Hi,

=FormatDateTime(Now, DateFormat.ShortDate)

Regards,

Thursday, May 29, 2014

Get vendor information in Dynamic AX

Hi,

static void GetVendInfo_Alfasith(Args _args)
{
    VendTable       vendTable;
    ;
    vendTable =  VendTable::find("1101"); // select the vendor account here
    info(strFmt("Name: %1", vendTable.name()));
    info(strFmt("Telephone    : %1", vendTable.phone()));
    info(strFmt("email        : %1", vendTable.email()));
    info(strFmt("Website/ blog: %1", vendTable.url()));
    info(strFmt("Fax          : %1", vendTable.telefax()));
    info(strFmt("Address      : %1", vendTable.postalAddress().Address));
}



Regards,

Get a table ID in SQL / table browser - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' <URL>/?cmp=<CompanyID>&mi=sysTableBrowser...