68) How to filter the record in form using executeQuery
I had a scenario where I need to Filter the form datable data source when its open :-
for this
Step 1 Create a excute query method on the form data source and write the below code :-
[Form]
public class SupervisedWorkorders extends FormRun
{
[DataSource]
class SupervisedWorkorders
{
/// <summary>
///
/// </summary>
public void executeQuery()
{
HcmWorkerRecId worker;
worker = HcmWorkerLookup::currentWorker();
var dataSource = this.query().dataSourceTable(tableNum(AvaSupervisedWorkordersView));
var currentWorkerRange = SysQuery::findOrCreateRange(dataSource,fieldNum(AvaSupervisedWorkordersView, HcmWorker));
currentWorkerRange.status(RangeStatus::Hidden);;
currentWorkerRange.value(strFmt('%1', SysQueryRangeUtil::value(worker)));
super();
}
}
}
Comments
Post a Comment