Hi,
I added a new int64 control (reference group) without filling dataSource, reference field, replacement field group properties on the form and I want it to look as tree view
then in the init method of the form (CaseDetailCreate) i added this line
ACaseCategory.RegisterOverrideMethod(methodStr(FormReferenceGroupControl, lookup), formMethodStr(CaseDetailCreate, AOverrideCaseCategoryLookup));
public void AOverrideCaseCategoryLookup(FormReferenceGroupControl _formReferenceGroupControl)
{
SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(CaseCategoryHierarchyDetail), _formReferenceGroupControl);
sysTableLookup.addLookupfield(fieldNum(CaseCategoryHierarchyDetail, CaseCategory));
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
queryBuildDataSource = query.addDataSource(tableNum(CaseCategoryHierarchyDetail));
CaseCategoryHierarchyDetail caseCategoryHierarchyDetail;
CaseCategoryType caseCategoryType;
select firstonly RecId from caseCategoryHierarchyDetail
where caseCategoryHierarchyDetail.CaseCategory == Control1.text()
if (caseCategoryHierarchyDetail)
{
this.findCaseCategoryChildAndSubChild(caseCategoryHierarchyDetail.ParentRecId, queryBuildDataSource);
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
public void findCaseCategoryChildAndSubChild(RefRecId _ParentRefRecId, QueryBuildDataSource _queryBuildDataSource)
{
CaseCategoryHierarchyDetail caseCategoryHierarchyDetail;
while select caseCategoryHierarchyDetail
where caseCategoryHierarchyDetail.parentRecId == _ParentRefRecId
{
_queryBuildDataSource.addRange(fieldNum(CaseCategoryHierarchyDetail,ParentRecId)).value(queryValue(caseCategoryHierarchyDetail.RecId));
this.findCaseCategoryChildAndSubChild(caseCategoryHierarchyDetail.RecId, _queryBuildDataSource);
}
}but the field is not appearing at all on the form, why is that? and what should I do to make a lookup tree for case categories?
I want it the same as the standard caseCategory, but the difference is that this one starts from a certain node and not show all case categories