web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

lookup on all jobs and department in position x++

(0) ShareShare
ReportReport
Posted on by 163
I need to create lookup on field get all jobs , descriptions and department in positions group by jobs (I need job appear one time avoid duplicate)
I tried this but field of department is empty 
            Query                   query;                QueryBuildDataSource    QueryBuildDataSource,QueryBuildDataSource1 , QueryBuildDataSource2;                SysMultiTableLookup SysMultiTableLookup;                query = new Query();                  QueryBuildDataSource = query.addDataSource(tableNum(HcmJob));                QueryBuildDataSource.addGroupByField(fieldNum(HcmJob,JobId));                //join the translation table so we can get a description of the UOM                QueryBuildDataSource1 = QueryBuildDataSource.addDataSource(tableNum(HcmJobDetail));                QueryBuildDataSource1.joinMode(JoinMode::InnerJoin);                QueryBuildDataSource1.relations(true);                QueryBuildDataSource1.addLink(fieldNum(HcmJob,RecId),fieldNum(HcmJobDetail,Job));                QueryBuildDataSource1.addGroupByField(fieldNum(HcmJobDetail,Description));                QueryBuildDataSource2 = QueryBuildDataSource1.addDataSource(tableNum(HcmPositionDetail));                QueryBuildDataSource2.joinMode(JoinMode::InnerJoin);                QueryBuildDataSource2.relations(true);                QueryBuildDataSource2.addLink(fieldNum(HcmJobDetail,Job),fieldNum(HcmPositionDetail,Job));                QueryBuildDataSource2.addGroupByField(fieldNum(HcmPositionDetail,Department));                QueryBuildDataSource2.addRange(fieldNum(HcmPositionDetail,Department)).value(queryValue(CFMJobRequisition.Dept));                QueryBuildDataSource2.addRange(fieldNum(HcmPositionDetail,Department)).status(RangeStatus::Locked);                //define multiple table lookup query                SysMultiTableLookup  = SysMultiTableLookup::newParameters(_formControl, query);                QueryBuildDataSource.addRange(fieldNum(HcmJob,JobStatus)).value(queryValue('Active'));                QueryBuildDataSource.addRange(fieldNum(HcmJob,JobStatus)).status(RangeStatus::Locked);                SysMultiTableLookup.addLookupfield(fieldNum(HcmJobDetail,Job), true);                SysMultiTableLookup.addLookupfield(fieldNum(HcmJobDetail,Description),2);                SysMultiTableLookup.addLookupfield(fieldNum(HcmPositionDetail,Department),3,true);                SysMultiTableLookup.performFormLookup();
 
 
I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at
    Hi Menna,
     
    I would suggest you create a custom view with all the required tables and add group by of fields inside the view itself.
    You can use that view in the lookup as DataSource for the query.
     
    Thanks,
    Girish S.
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
     
    Can you give me more details about your requirement? you need to return jobs as a lookup based on position? Give me example about the data how it should be returned, because the structure as the following:
     
    1- HcmPosition(Position) has a relation with HcmPositionDetail
    2-HcmPositionDetail has a relation with Department 
    3-HcmPositionDetail has a relation with HcmJob
    4- HcmJob has a reation with HcmJobDetails(that contain Job Description field)
     
     
    Regards,
    Waed Ayyad
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans