9

We've added logic to SalesLine validateWrite method, to show dialog to collect details that we update on save of SalesLine, when editing an existing record. When the user is on 'Lines' display and moves to 'Header' display, options shown in the middle of the screen, the dialog is shown twice, if cancel pressed on the dialog and details not entered. This is due to SalesLine save/validateWrite being called twice by MS on the form. This can be replicated by just having an 'info' message in validateWrite, so it shows it's called twice, or writing simple sysOpeartion class to be called, which is triggered twice when moving from 'Lines' to 'Header' on editing existing line.

 

There’s also a second issue with validateWrite, as it’s called when user clicks close form in top right. In this instance the validateWrite is called 3 times, but without ‘wait’ being set, so the dialog just appears and disappears, without allowing the user to enter anything. Are Microsoft aware of this behaviour?


When running the below code with ret=true it works fine but when running it with ret=false it shows the info dialog multiple times.


[SalesLine].modifiedField = function (fieldId) {

   var ret = this.callBase(fieldId);

   if (fieldId == 'SalesId') {

       // Set flag to indicate that the SalesId field has been modified

       this._salesIdModified = true;

   }

   return ret;

}

 

[SalesLine].validateWrite = function () {

   var ret = true;

   if (this._salesIdModified) {

       // Show dialog to collect details

       // Reset flag to indicate that the SalesId field has not been modified

       this._salesIdModified = false;

   }

   return ret;

}

Category: Development
STATUS DETAILS
New

Comments

A

Code is:

[SalesLine].modifiedField = function (fieldId) {


  var ret = this.callBase(fieldId);


  if (fieldId == 'SalesId') {


      // Set flag to indicate that the SalesId field has been modified


      this._salesIdModified = true;


  }


  return ret;


}


 


[SalesLine].validateWrite = function () {


  var ret = true;


  if (this._salesIdModified) {


      // Show dialog to collect details


      // Reset flag to indicate that the SalesId field has not been modified


      this._salesIdModified = false;


  }


  return ret;


}

Category: Development