Alfasith AX

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

Tuesday, September 24, 2019

Tuesday, September 3, 2019

User ID to user name or Worker Name in AX 2012 / D365

Hi,

Worker = HcmWorker::find(DirPersonUser::findUserWorkerReference(UserId));

or

    public static Name userName(UserId _userId)
{
    DirPartyName        partyName;

    partyName = DirPersonUser::userId2Name(this.UserId); //_UserId
    if (!partyName)
        partyName = (select firstonly Name from userInfo where userInfo.Id == this.UserId).Name;
    if (!partyName)
        partyName = this.UserId;
    return partyName;
}

public static UserID Worker2UserId(HcmWorkerRecId _WorkerRecId)
{
    DirPersonUser   personUser;
    HcmWorker       worker;
     select User from personUser
         exists join worker
            where worker.Person == personUser.PersonParty
                    && worker.RecId == _WorkerRecId;
   
    return personUser.User;
}

Regards

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...