Form is not reloading

El Cuchi
Tera Guru

Hi all,

 

Hopefully this is an easy one.

 

Situation

I created a BR to check for something in the change request form when using the 'request approval' button. if true a message should be displayed and abort action. Otherwise, it will move to assess.

 

Problem

Although the BR is triggered as expected, the message is displayed and the action is aborted. the form is not reloading. Hence, it appears to the user that the stage moved to assess and all fields are read-only (image attached).

The only way for the form to reload is to reload the browser.

 

 

BR details:   Before Update

    var value = current.getUniqueValue();
    var gr = new GlideRecord('change_request');
    gr.addQuery('parent', value);
    gr.query();
    if (!gr.next()) {
        current.setAbortAction(true);
        gs.addErrorMessage(' Bla Bla Bla Bla.');        
    }
2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @El Cuchi 

 

Check is any BR running on same and creating this issue.

*************************************************************************************************************
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]

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

AshishKM
Kilo Patron
Kilo Patron

Hi @El Cuchi ,

The BR is checking the parent record of CHG and aborting the current action on that record which is about to apply by UI Action ( request approval ), this request approval is keeping the same record page after setting the value, infact BR is aborting the whole action along with redirect part.

 

Add this line in BR, hope it should work otherwise you have to check this desire login in the UI Action itself.
response.setRedirectURL(current);

 

UI Action runs on client side and BR runs on Server side , once BR abort BR don't know where it has to go unless redirect configured. My suggestion keep this logic check in UI Action, avoid the server job. 

 

 

var value = current.getUniqueValue();
    var gr = new GlideRecord('change_request');
    gr.addQuery('parent', value);
    gr.query();
    if (!gr.next()) {
        current.setAbortAction(true);
        gs.addErrorMessage(' Bla Bla Bla Bla.'); 
        response.setRedirectURL(current); // set the destination which is current record
    }​

 

 

 

-Thanks,

AshishKMishra


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution