[Utah] onChange works after canceling a two-choice message (confirm).

norio kondo
Tera Contributor

When I perform the following operations on a screen implemented in Workspace, the event in (5) occurs.
Please let us know the cause of the problem and how to deal with it.
Environment: Utah patch7a


(1) Manually enter a code value in the reference item "A code" and select the candidate displayed (focus out).
(2) Display a two-choice message (confirm) in the client script (onChange).
(3) Select "Cancel" in the two-choice message (the subsequent process of onChange returns the A code to the one before the change).
(4) The two-choice message is closed and the "A code" is restored to its original value.
(5) If you click on the appropriate area on the screen, the same two-choice message is displayed again.


The client script (onChange) updates "A code" in the client script (onChange), so that the client script (onChange) is called triggered by it is already taken care of (controlled by g_scratchpad.isCanceled).
*It is not reproduced when the magnifying glass of "A code" is clicked => A code is selected on the child screen.

Code Example

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    if (g_scratchpad.isCanceled) {
        g_scratchpad.isCanceled = false;
        return;
    }

    if (g_scratchpad.previousValue != newValue {
        getMessage('MessageXXXXX', function(msg) {
            if (confirm(msg)) {
                g_scratchpad.previousValue = newValue;
            } else {
                g_scratchpad.isCanceled = true;
                if (g_scratchpad.previousValue != undefined) {
                    g_form.setValue('u_code_A', g_scratchpad.previousValue); // "A code"
                } else {
                    g_form.setValue('u_code_A', oldValue); // "A code"
                }
            }
        });
    }

 

6 REPLIES 6

Thanks for your advice, it is much appreciated.
I don't see the problem in your instance.
I am still having problems in my environment.
I am developing in Japanese language, but I wonder if it has anything to do with it.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @norio kondo 

 

Seems it is know issue. We had same case and tech team reached out to SN for solution. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************