Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Activity lookup based on project Id

(0) ShareShare
ReportReport
Posted on by 50

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,816 Super User 2024 Season 1 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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,684 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,414 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans