Override LookUp Event handler with Adding range

 [FormControlEventHandler(formControlStr(CustTable, CustTable_GCNPABranch), FormControlEventType::Lookup)]

public static void CustTable_GCNPABranch_OnLookup(FormControl sender, FormControlEventArgs e)

{

    SysTableLookup          sysTableLookup;

    QueryBuildDataSource    queryBuildDataSource, qbds;

    QueryBuildRange         queryBuildRange;

    Query                   query;


    sysTableLookup = sysTableLookup::newParameters(tableNum(InventLocation), sender);


    sysTableLookup.addLookupfield(fieldNum(InventLocation, InventLocationId));

    sysTableLookup.addLookupfield(fieldNum(InventLocation, Name));

    sysTableLookup.addLookupfield(fieldNum(InventLocation, InventSiteId));


    query = new Query();


    queryBuildDataSource = query.addDataSource(tableNum(InventLocation));

    queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventLocation, DistributionCenter));

    queryBuildRange.value('1');


    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();


    FormControlCancelableSuperEventArgs event = e as FormControlCancelableSuperEventArgs;


    event.CancelSuperCall();

}

Comments

Popular posts from this blog

Assembly reference containing type is not referenced, Object 'CLRObject' could not be created

Extract data of PO from the System in Ax 2012

Send email using .Net framework