A little background is that I am attempting to build a custom page with DS to be used to certify effort that combines the functionality of a couple of GM screens. I have gotten every piece of this project to work when the various functions are segregated out to their own action buttons but I am running in to trouble when I attempt to combine the various pieces in to one button (and add some conditional logic). The problem is timing related. Essentially functions that are called further down in my code are firing off before other functions have completed DB updates. To address this I am trying to use return messages to better control the timing of the functions (or to stop them completely).
In the code example below the key is the Change functionality. If all goes well the “Change Complete” message should be returned by Lawson. However, when I execute this code the message in the alert is “Inquiry Complete”. This message does not appear on the bottom left hand side of the portal page at any time and therefore must be a remnant of the page loading. When I clear the alert I then see the “Change Complete” message on the bottom left of the Portal screen (but not in the alert). If I rerun the function without refreshing “Change Complete” is now returned because it is now the last message in memory even if the subsequent change function is disallowed. Consequently, my alert always seems to be one step behind. I need a mechanism to ensure that the change is in fact complete before the code moves on since a subsequent AGS call is not valid unless this change is truly complete. If anyone has any ideas on how to better approach this issue, I would be grateful for any advice. Thanks!
Code example:
function doCertPop()
{
var certques = confirm ("Cert Language")
if (certques)
for (var i=0; i<11; i++) {
if (lawForm.getFormValue("out12",i) > valtest)
NumRows = i + 1
lawForm.setFormValue("fc1",'T',i);
}
lawformDoFunction("C");
var vLastMsg = lawForm.getMessage();
alert(vLastMsg);
if (vLastMsg == "Change Complete - Continue")
alert("Satisfied");
// lineCount1();
else
alert("No updates have been submitted.");