Saturday, August 29, 2015

How to check table size from SQL server

We often require to check size of the table to moniter database performance, specially working with files and storing it in database. AX does store files in database which can be setup under Document types in Document Management module.

We can use following sql command to get table size;

sp_spaceused docuValue

Sunday, August 23, 2015

Retrieve worker email address through X++

Below code snipet is one of the way to retrieve employee/worker's primary email address.

private LogisticsElectronicAddressLocator getInstructorEmail(HcmWorkerRecId  _workerRecId)
{
    LogisticsElectronicAddress  logisticsElectronicAddress;
    HcmWorker                   hcmWorker;
    DirPerson                   dirPerson;
    DirPartyTable               dirPartyTable;

    select hcmWorker
        where hcmWorker.RecId == _workerRecId
    join dirPerson
        where dirPerson.RecId == hcmWorker.Person
    join dirPartyTable
        where dirPartyTable.RecId == dirPerson.RecId
    join logisticsElectronicAddress
        where dirPartyTable.PrimaryContactEmail == logisticsElectronicAddress.RecId;

    return logisticsElectronicAddress.Locator;
}