Wednesday 30 June 2021

Add Grid Control to dialog form in Sys Operation Framework in D365 F&SCM

 Hi All,


Recently I have a requirement for adding the grid control to the dialog form for one of the batch processing operation using sys operation framework.

So let's explore how to do it:


  • It will be really difficult to add the grid control at run time in dialog form using code, so better to create a new form with dialog pattern as Dialog - FastTabs


  • Now in your controller class, override "templateForm" method and give our custom dialog form name as shown below:
  • This will override the standard dialog form and use our custom form.

  • Now since we have implemented a new custom form instead of standard dialog form, we will not get the option "Records to include" for filtering data as we do in standard dialog form, so to resolve this issue, create a new button in your form (Label it as "Records to include") and use the below code on click of this button to get the "Records to include" button as below:

  • In the above image "isQueryRunData" and "queryRun" are global variables, which will help us to decide when to update the standard query in executeQuery() of form data source with our new filtered query after we select some filters in our query using Records To Include button so that our data in the grid gets modified based on the filter selection as shown below:



  • Now we want to pass our modified query back to our contract class SetQuery() so that it can update the original query object of controller class with our filtered query, to get that write code as below on the click of "close ok" button of our form:


  • Now finally in the "processOperation()" of service class fetch the query using queryRun() and loop the data:
    


  • Finally this is how our form will look like:



  • Click on Records To Include Button to view the filter form:




  • Thanks for reading this, let me know if you need any clarification.

No comments:

Post a Comment

Insert/Update or remove the default dimension value in D365 FSCM via x++

Use below method to insert/update the dimension values, just pass the parameter values to the method and it will return the updated value: p...