Incorrect Variable value in confirmation message

I have a link on a web block on a web screen that uses a local variable in an if statement in the confirmation message.  The variable is incremented/decremented by other actions (add record, onchange, save, etc). in the web block. I want the confirmation message to notify the user that the records were changed and let them go back to save them or proceed without saving and use this variable to determine if changes were made.  When the link is clicked, the variable is the same as the value before the changes are made to it.   But when I display a feedback message in the screen action called by the link, the variable has the correct value.  It is only in the confirmation message the at value is incorrect.  How do  I get the correct value of the  the variable in the confirmation message of the link?

Hi Mike,


Can you share some screenshot or oml?


Thanks,

Rajat Agrawal

Solution

Hi Mike,

I am not sure I fully understood the problem, but I'll try to help anyway.

When the browser requests the page, the server initializes the local variables (like the local variable you are using), to the default value of the data type if none other is provided (0 for integer).

After the preparation, when the server is building the HTML to send back the browser, the link is "hardcoded" into the HTML of the page, with the ACTUAL value of the variable (0, at this point).

So, when the browser receives the page to render in the screen, the link confirmation message is already there with the 0 in it (or any other value you initialized the variable).

Unless your next requests to the server, that increments the variable, are made with the SUBMIT method, or you use an AJAX REFRESH in the link in case you're using AJAX SUBMIT method, the link will not change and will keep the initial value in the message.

So, if you are doing AJAX SUBMIT to the server, you need to AJAX REFRESH the link so that the server rebuild it with the new value of the variable.

I think the problem is this, but let us know anyway.

Cheers. 

Solution

Thank you both for your replies.  Eduardo, you are correct; I was not using Ajax refresh to refresh the link when I was changing the value of the variable.  Problem solved!  Thanks again!


Hello Mike,

Nice to hear. Would you be kind and mark the answer as final solution? This helps close the topics as solved helping keek the community forum easy to find solutions.

Cheers