Add sort field on grid using form datasource in MSD axapta

To Add sort field on grid using form data source in axapta  you can do following code in form data source table on execute query method.

 public void executeQuery()  
 InventTable_ds.query().dataSourceNo(1).addSortField(fieldNum(CustTable,CustGroup), sortOrder::Ascending);  
 After adding code you can call in modified method of control or init method of form.  
 public boolean modified()  
  boolean ret;  
  ret = super();  
 return ret;