Saturday, 21 March 2020

Form Filter by Execute Query


1) GO to FORM--> Datasource--> Events---> OnQueryExecuting--> Copy EventHandlerMEthod
2) Create Class by Extension of FormDataSource(FormName, DatasourceName))]
     Final class XXXXX_Extension
{
 Paste Copied Eventhandler here and change according to example below.
}

EXAMPLE:

[Extensionof(FormDataSourcestr(SysUserManagement, UserInfo))]
final class SYSUSERINFO_Extension
{     


    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
 

    [FormDataSourceEventHandler(formDataSourceStr(SysUserManagement, UserInfo), FormDataSourceEventType::QueryExecuting)]

    public static void UserInfo_OnQueryExecuting(FormDataSource sender, FormDataSourceEventArgs e)

    {

        FormRun          SysUserManagementForm = sender.formRun();

        sender.query().dataSourceName(sender.name()).addRange(fieldnum(UserInfo, Company)).value(queryValue('USMF'));
     

    }

}

No comments:

Post a Comment

POSTMAN D365

  Postman is useful to test the behavior of different OData class from/to D365FO. In this post we will see the steps to setup Postman with D...