I have the following method which compiles:
private void onModifiedFilter(FormControl sender)
{
FormDataSource mainAccount_ds = sender.formRun()
.dataSource(formDataSourceStr(MainAccount, MainAccount));
mainAccount_ds.executeQuery();
}
As I have no other use for mainAccount_ds
, I would like to inline the value and simplify the code to:
private void onModifiedFilter(FormControl sender)
{
sender.formRun()
.dataSource(formDataSourceStr(MainAccount, MainAccount))
.executeQuery();
}
However, this fails to compile with:
Severity Code Description Project File Line Suppression State Error ClassDoesNotContainMethod: Class 'FormObjectSet' does not contain a definition for method 'executeQuery' and no extension method 'executeQuery' accepting a first argument of type 'FormObjectSet' is found on any extension class. Packt_MainAccountExtension (ISV) [ExpenseManagement] C:\AOSService\PackagesLocalDirectory\Bin\XppSource\ExpenseManagement\AxClass_Packt_MainAccountForm_Extension.xpp 18
- How/why does capturing
mainAccount_ds
alter the ability for this method to compile? - Are there other ways I can express this without the unnecessary data capture?
- When else in D365 should I expect some magic where I will need to capture a value in order to make use of it, rather than directly invoking a method upon an uncaptured return value?