Hello everyone,
There is a form called InventNonConformanceTableCreate that I have added a new field to
The datasource of that form is InventNonConformanceTable
I created a new EDT and new field called TCI_InventProblemSubTypeId
The information for this field is in a table called TCI_InventProblemSubType which has the following fields:
Description
ProblemTypeId (related to table InventProblemType)
ProblemSubTypeId
Here is what it looks like on the form

What I'm trying to accomplish is overwriting the lookup for that Problem subtype so that it only shows the subtypes that are related to the chosen Problem Type.
I've done this before on a form we created which made it easy. I could right-click on the methods of the field in the datasource and overwrite the lookup. Now I'm not sure how to do this correctly.
I've tried a few different ways but so far nothing has worked.
This is my code from the other form that we created that works great
[DataField]
class InventLocationId
{
///
///
///
///
///
public void lookup(FormControl _formControl, str _filterStr)
{
//Specify the name of the table the lookup should show data from.
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation), _formControl);
//Create a new query
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
//Specify the name of the table the lookup should show data from.
queryBuildDataSource = query.addDataSource(tableNum(InventLocation));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation,InventSiteId));
queryBuildRange.value(queryValue(TCI_ItemTable.InventorySite));
//Specify which fields should be shown in the lookup form.
// field returned is the first field referenced
sysTableLookup.addLookupfield(fieldNum(InventLocation, InventLocationId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}
Now I can easily adjust this code to look at the right tables and return the right fields, but where do I put this to get it to run?