Redirect to a blank page

Pedro Nascimen1
Tera Contributor

Hello,

I've a UI action to request for approval after a normal change has been raised, of course when you raise a normal change a specific workflow starts and waits for that action to proceed.

The problem is when you request for approval it always redirects to a blank page.

This is the original code:

current.approval = "requested";

current.update();

action.setRedirectURL(current);

//action.setReturnURL(current);

I also tried a lot of different things, for instance:

var urlDirect = gs.getProperty("glide.servlet.uri") + "/nav_to.do?uri=" + current.sys_class_name + ".do?sys_id=" + current.sys_id;

current.approval = "requested";

current.update();

action.setRedirectURL(urlDirect);

//action.setReturnURL(urlDirect);

None of the approaches worked, always the same thing, it redirects to a blank page.

Any ideas or work around to solve this?

14 REPLIES 14

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Pedro,



Can you check the URL to which you are trying to redirect is formed correctly?



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,



Thanks for your answer.



Yes, I already did a gs.log(urlDirect) just to make sure the URL was being formed correctly and it is, I copied that and pasted that into the browser, opened the record without any problems.



Cheers,
Pedro


gdd
Giga Expert

try below



  1. var urlDirect = "/" + current.sys_class_name + ".do?sys_id=" + current.sys_id;  
  2. current.approval = "requested";  
  3. current.update();  
  4. gs.log(action); // see if action is available in the script
  5. action.setRedirectURL(urlDirect);  


Hi Girish,



Thanks for your answer.



Didn't work, still redirects to a blank page.


gs.log(action) returned: com.glide.script.Action@1e47f67



Cheers,
Pedro Nascimento