Tuesday, September 17, 2013

Address Book Wise Employees in Ax2012 R2

Code to display all employee's based on Address Book RecId

static void AddressBookwiseEmployees(Args _args)
{
    DirAddressBook      addressBookRecord;
    DirAddressBookParty addressBookPartyRecord;
    Hcmworker           hcmworker;

    while select hcmworker
        exists join AddressBook from addressBookPartyRecord
         join Name from addressBookRecord
            order by addressBookRecord.Name
            where addressBookPartyRecord.AddressBook ==      5637144577 &&
                  addressBookPartyRecord.Party ==    hcmworker.Person &&
                  addressBookRecord.IsSystem == NoYes::No
    {
        info(strFmt("%1",hcmworker.name()));
    }
}

Here 5637144577 is RecId of DirAddressBook.

No comments:

Post a Comment