Hi developers,
I have a requirement in which I am having a custom field at form which is showing some lookup values.
My requirement is I need to show the only the project id in lookup where cost center value of worker is equal to project cost center value.
Thanks!!
Hi Girish ,
The below code is working fine...
Query query = new Query();
QueryBuildDataSource qbds,qbds1;
ProjTable projTable;
DefaultDimensionView dimensionViewWorker;
HcmEmployment employment;
select * from employment
where employment.Worker == 25678909//passs your curren worker from your custom table.
join dimensionViewWorker
where dimensionViewWorker.DefaultDimension == employment.DefaultDimension
&& dimensionViewWorker.Name == "CostCenter";
qbds = query.addDataSource(tableNum(projTable));
qbds1 = qbds.addDataSource(tableNum(DefaultDimensionView));
qbds1.relations(false);
qbds1.addLink(fieldNum(ProjTable, DefaultDimension),fieldNum(DefaultDimensionView, DefaultDimension));
qbds1.addRange(fieldNum(DefaultDimensionView, DisplayValue)).value(queryValue(dimensionViewWorker.DisplayValue));
//add code to SysTableLookup.
Thanks.
Hi Girish,
Tried the same way but its not working.
(Practice is one of the financial dimension)
select RecId from employment
where employment.Worker == worker.RecId
&& worker.RecId == personalTimeOffRequest.CurrentWorker;
dimensionValueWorkerTable =
(select firstOnly DisplayValue from DefaultDimensionView
where DefaultDimensionView.Name == #Practice
&& DefaultDimensionView.DefaultDimension == employment.DefaultDimension).DisplayValue;
dimensionValueProjTable =
(select firstOnly DisplayValue from DefaultDimensionView
where DefaultDimensionView.Name == #Practice
&& DefaultDimensionView.DefaultDimension == projtable.DefaultDimension).DisplayValue;
Thanks.
You can make use of DefaultDimensionView to get the financial dimension value against the particular financial dimension like Cost center.
DefaultDimensionView will be having field called "Name" which will have "Cost center", "Department" etc.
ProjTable and DefaultDimensionView will be related through DefaultDimension field.
For Worker you need to consider HcmEmployment table.
HcmEmployment and DefaultDimensionView will be related through DefaultDimension field.
You can build the above as a lookup query and check.
Thanks,
Girish S.
Yes Girish, I have a custom control that already contains the lookup based on another criteria, I am trying to make onlookup event handler to add my functionality as well in the existing lookup.
Thanks!!
Hi D365 ER,
You have one custom control which shows lookup of projId. So that lookup must be filtered to show projId if project cost center and worker cost center is same?
Is that you are asking?
Thanks,
Girish S.
André Arnaud de Cal...
292,074
Super User 2025 Season 1
Martin Dráb
230,900
Most Valuable Professional
nmaenpaa
101,156