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

Announcements

No record found.

News and Announcements icon
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.

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at

    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 558 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 402

#3
Diego Mancassola Profile Picture

Diego Mancassola 261

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans