DAXSPOT

Wednesday, August 3, 2022

Department for the current user in X++ select statement

Hi All,

Below you will find a snippet to get department for the current user.


select OMOperatingUnit 

            join HcmPositionDetail

                where OMOperatingUnit.RecId == HcmPositionDetail.Department

            join HcmPosition 

                where HcmPositionDetail.Position == HcmPosition.RecId

            join HcmPositionWorkerAssignment

                where HcmPosition.RecId == HcmPositionWorkerAssignment.Position

            join HcmWorker 

                where HcmPositionWorkerAssignment.Worker == HcmWorker.RecId

            join DirPerson 

                where HcmWorker.Person == DirPerson.RecId

            join DirPersonUser 

                where DirPersonUser.PersonParty == DirPerson.RecId 

                && DirPersonUser.User == curUserId();

No comments:

Post a Comment

How to execute SQL directly form Dynamics AX X++

How to execute Sql directly form Dynamics AX X++ Reference by : alirazazaidi Dynamics Ax provide many other ways to communicate with databas...