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

Activity lookup based on project Id

(0) ShareShare
ReportReport
Posted on by 58

Hi,

I have a requirement to make an activity lookup based on the project id as same as in all timesheet form for this i override lookup method of control and use the following code please consider bellow screenshot.

public void lookup()
        {
            //super();

            Query                   query = new Query();
            QueryBuildDataSource    qbdsSmmActivities, qbdsProjTable, qbdsActivityParentLinkTable;
            QueryBuildRange         qbrActivityParentLinkTable, qbrProjTable;
            QueryBuildLink          qbl1, qbl2;

            SysTableLookup  sysTableLookup = sysTableLookup::newParameters(tableNum(smmActivities), this);

            sysTableLookup.addLookupfield(fieldNum(smmActivities, ActivityNumber));

            qbdsSmmActivities = query.addDataSource(tableNum(smmActivities));

            qbdsActivityParentLinkTable = qbdsSmmActivities.addDataSource(tableNum(SmmActivityParentLinkTable));
            qbdsActivityParentLinkTable.relations(false);
            qbdsActivityParentLinkTable.joinMode(JoinMode::OuterJoin);
            qbdsActivityParentLinkTable.addLink(FieldNum(SmmActivityParentLinkTable, ActivityNumber),FieldNum(smmActivities, ActivityNumber));
            qbrActivityParentLinkTable = qbdsActivityParentLinkTable.addRange(fieldNum(SmmActivityParentLinkTable, ParentType));
            qbrActivityParentLinkTable.value(queryValue(smmActivityParentType::Project));

            qbdsProjTable = qbdsActivityParentLinkTable.addDataSource(tableNum(ProjTable));
            qbdsProjTable.relations(false);
            qbdsProjTable.joinMode(JoinMode::OuterJoin);
            qbdsProjTable.addLink(fieldNum(ProjTable, RecId), fieldNum(SmmActivityParentLinkTable, RefRecId));

            qbrProjTable = qbdsProjTable.addRange(fieldNum(ProjTable, ProjId));
            qbrProjTable.value(XYZ.valueStr());
            
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
        }

But I am unable to get the filtered values of activity numbers based on project id.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Moderator on at
    RE: Activity lookup based on project Id

    Hi You can refer to the standard TsTimesheetEntry >> TsTimesheetLine (DataSource) >> ActivityNumber (Fieldname) >> lookup (Method) >>You can directly call the method mentioned to filter activity number against project id.

    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…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans