Confirmation dialog before deleting a record
This is an example of a button click handler, named deleteRelatedRecord(), which would prompt a user for confirmation before deleting data tied to a detail row record.
We see the async keyword added to the front of the function, this allows us to use await in front of the messageBox() call. Doing so will wait for the user to respond to the dialog, confirming they intended to delete the record. If we do not use async/await here, the "yes" code would run, and we would delete the record without waiting for actual confirmation. Note: this behavior is for 10.0.11.7+, 10.0.10.6+, and 10.0.9.5+ of Lawson Portal and Infor Design Studio.
async function deleteRelatedRecord()
{
const message = 'You are about to delete the selected record from the database,' +
' this action cannot be undone, are you sure you want to proceed?';
if (await portalWnd.cmnDlg.messageBox(message, 'yesno', 'question') === 'yes')
{
// user confirmed deletion, we would run an AGS call to delete some type of record
}
else
{
// user selected no, run some other code or return
}
}