In this example I’ll show how to obtain the source record from a caller object.
Suppose you have a form A that calls form B.
In Form B you want to know what is the data source of the Form A and if it’s a VendTable you want to retrieve the AccountNum field
VendTable vendTableLocal;
switch (element.args().record().dataSource().Name())
{
case 'VendTable':
vendTableLocal = element.args().record() as VendTable;
break;
default:
break;
}
if(vendTableLocal)
{
while select al0VendorSearchCriteriaLocal
where al0VendorSearchCriteriaLocal.AccountNum == vendTableLocal.AccountNum
{
element.ExpandAndSelect(al0VendorSearchCriteriaLocal.VendorActivityRefRecId, formFirstRun);
}
;
}