Monday, July 16, 2018

Event handler for QueryExecuting to filter data

Event handler for QueryExecuting to filter data


You can use the below code sample to filter data in query execution event

1. Copy Form ->Data source  >Event > onQueryExecuting.
2. Paste this code in the New class.



  [FormDataSourceEventHandler(formDataSourceStr(PayrollEmployerTaxRegion, PayrollEmployerTaxRegion), FormDataSourceEventType::QueryExecuting)]
    public static void PayrollEmployerTaxRegion_OnQueryExecuting(FormDataSource sender, FormDataSourceEventArgs e)

    {

        sender.query().dataSourceName(sender.name()).addRange(fieldnum(PayrollEmployerTaxRegion,     CountryRegionId)).value(queryValue(LogisticsAddressCountryRegion::findByISOCode(SysCountryRegionCode::countryInfo(curext())).CountryRegionId));

    }

No comments:

Post a Comment