Hey team,
On the smmOpportunitytable form when I click new( ) option I have a custom form to create opportunities. The form has a custom field "Profit center" which is reference group but this reference group has no data source. It is extended from a customize EDT named "XYZ_ProfitCenter" which has table relation as:

Form:

I have created another table named "Retired Profit centers" now my issue is that I want to customize a lookup on this (Profit center) reference group and not include all the profit center which are in the "Retired Profit centers" table. As the data source is not specified for this reference group I cannot use "Lookupreference" method on the datasource. I have written the below code by overriding the lookup method on the form field but it is not working. Please let me know how can I create a custom lookup on the reference group in this scenario".
[Control("ReferenceGroup")]
class ProfitCentre
{
///
///
///
public void lookup()
{
super();
RetiredProfitCenters retiredprofitcenter;
OMOperatingUnit omoperatingunit;
while select * from retiredprofitcenter
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(OMOperatingUnit), this);
sysTableLookup.addLookupfield(fieldNum(OMOperatingUnit,OMOperatingUnitNumber));
sysTableLookup.addLookupfield(fieldNum(OMOperatingUnit,OMOperatingUnitType));
queryBuildDataSource = query.addDataSource(tableNum(RetiredProfitCenters));
queryBuildDataSource.addRange(fieldnum(RetiredProfitCenters,OMOperatingUnitNumber)).value(SysQuery::valueNot(retiredprofitcenter.OMOperatingUnitNumber));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}
}