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, ...
Unanswered

How to extend standard ProjTable LookupReference with new datasource?

(0) ShareShare
ReportReport
Posted on by 59

pastedimage1609384427368v1.png

pastedimage1609384608290v2.png 

Hi, I want to add new field on that standard Project lookup. so I created a view to get the field I want (B1_Business_Unit). This Project lookup got reference group and using referenceLookup method. Now I need to change the source projtable with the view I created in order to add the new field on the lookup. but when I try to extend the LookupReference method, they pop out an error as below and it seems like I cannot replace ProjTable with the view I created. But I need to change it so I can get the B1_Business_Unit field.

pastedimage1609385463393v3.png

Does anyone know how can I solve this issue? Thanks in advance. 

I have the same question (0)
  • WillWU Profile Picture
    22,363 on at

    Hi nadiah sukerman,

    Could you please share your code?

    You could use sysTableLookup.addLookupfield method to add your new field.

  • nadiah sukerman Profile Picture
    59 on at

    Hi Will, Thanks for the reply. yeah sure, below I paste together my code. btw, systablelookup or sysreferencetablelookup? we need to use sysreferencetablelookup if reference group isnt it?

       [FormControlEventHandler(formControlStr(TrvRequisition, ProjTable_Details), FormControlEventType::Lookup)]

       public static void ProjTable_Details_OnLookup(FormControl sender, FormControlEventArgs e)

       {  

           SysReferenceTableLookup sysRefTableLookup  = SysReferenceTableLookup::newParameters(tableNum(ProjTableFinancialDimension), sender);

           Query                   query           = new Query();

           QueryBuildDataSource    qbds, qbdsProjStatusTypeRule;

           QueryBuildRange         qbrHeader, qbrStatus, qbrType, qbrProjStatusRule;        

           qbds = query.addDataSource(tableNum(ProjTableFinancialDimension));

           qbds.addSortField(fieldNum(ProjTableFinancialDimension, ProjId));

           qbrHeader = qbds.addRange(fieldNum(ProjTableFinancialDimension, Header));

           qbrHeader.value('0');

           qbrStatus = qbds.addRange(fieldNum(ProjTableFinancialDimension, Status));

           qbrStatus.value(SysQuery::valueNot('4'));

           qbrType = qbds.addRange(fieldNum(ProjTableFinancialDimension, Type));

           qbrType.value(SysQuery::valueNot('5'));

           qbdsProjStatusTypeRule = qbds.addDataSource(tableNum(ProjStatusTypeRule));

           qbdsProjStatusTypeRule.addLink(fieldNum(ProjTableFinancialDimension, Status),fieldNum(ProjStatusTypeRule, ProjStatus));

           qbdsProjStatusTypeRule.addLink(fieldNum(ProjTableFinancialDimension, Type),fieldNum(ProjStatusTypeRule,ProjType));

           qbdsProjStatusTypeRule.joinMode(JoinMode::ExistsJoin);

           qbrProjStatusRule = qbdsProjStatusTypeRule.addRange(fieldNum(ProjStatusTypeRule, ProjStatusRule));

           qbrProjStatusRule.value('5');

           // Run lookup

           sysRefTableLookup.parmQuery(query);

           //Add fields

           sysRefTableLookup.addLookupfield(fieldNum(ProjTableFinancialDimension, ProjId));

           sysRefTableLookup.addLookupfield(fieldNum(ProjTableFinancialDimension, Name));

           sysRefTableLookup.addLookupfield(fieldNum(ProjTableFinancialDimension, B1_Business_Unit));

           sysRefTableLookup.addLookupfield(fieldNum(ProjTableFinancialDimension, B1_Business_Unit_Desc));

           sysRefTableLookup.performFormLookup();

           FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;

           //cancel super() to prevent error.

           ce.CancelSuperCall();

       }

  • WillWU Profile Picture
    22,363 on at

    Hi nadiah sukerman,

    Yes you are right,  SysReferenceTableLookup is used for reference group field.

    Did you debug your code?

  • nadiah sukerman Profile Picture
    59 on at

    Yes, thus it can be build successfully but below error message pop out. I compared the code with the online source, it seems similar with them. but I'm not sure why the message said projtable does not exist as a formdatasource. This form name was Travel Requisition form. 

    pastedimage1609398351380v1.png

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