Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Related List Loading After Page Refresh

Chris Sutton
Tera Expert

Hi all,

Have tried trawling Community for an answer for this but have had no luck. I am experiencing an issue with a custom task type having approvals load after the page refreshes via UI Action.

Code:

current.state = 5;
current.update();
action.setRedirect(current);

I tried adding the following, however the page then reloads to the previous screen instead:

current.state = 5;
gs.sleep(1000);
current.update();
action.setRedirect(current);

I've tried looking at the Change Request table as this works correctly, however have been unable to figure this out. Should I store the URL somehow and then redirect to this? Or is there an easier method?

Any help would be appreciated 🙂

Thanks,
Chris

1 ACCEPTED SOLUTION

Mahesh23
Mega Sage

Hi,

There is a small error in you code.

Its setRedirctURL() not setRedirct()

Try below code

current.state = 5;
current.update();
action.setRedirectURL(current);

 

Please mark my response as correct answer or helpful if applicable.

View solution in original post

4 REPLIES 4

Mahesh23
Mega Sage

Hi,

There is a small error in you code.

Its setRedirctURL() not setRedirct()

Try below code

current.state = 5;
current.update();
action.setRedirectURL(current);

 

Please mark my response as correct answer or helpful if applicable.

Hi Mahesh,

Something so simple that I completely missed! Thanks for your help.

I updated the code to this and had the desired effect:

current.state = 5;
current.update();
gs.sleep(1000);
action.setRedirectURL(current);

Thanks again,
Chris

Hi,

Why are you making use of gs.sleep() ?

Hi Mahesh,

I need the UI Action to wait until the Related Lists have loaded before refreshing. Hence the 1 second delay.

Thanks,
Chris