Skip to main content

Notifications

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();
 
 
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 7,257 Super User 2025 Season 1 on at
    lookup on all jobs and department in position x++
     
    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
     
  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    lookup on all jobs and department in position x++
    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans