- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 04:10 AM
Hi All,
I've trying to add a wait condition to a UI policy to allow a workflow to complete before the page is refreshed
i have tried gs.sleep(); which worked in our test instance but not in production
although after further investigation i've found this is not the best practice.
Has anyone had any experience adding a wait for 5 seconds or so before redirecting to the current page?
UI Action:
Name: Submit
Table: Change_request
order: 100
script:
answer = current.insert();
gs.include('ActionUtils');
var au = new ActionUtils();
au.postInsert(current);
gs.sleep(4500);
action.setRedirectURL(current);
cheers
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 07:22 AM
Use a UI policy instead
But also with that being said, your script is using GlideRecord in a client side code. While this will work, best practices (for performance reasons) is to use GlideAJAX/client callable script include instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:15 AM
This definitely isn't a good idea since it will cause the page to hang and also it might not operate consistently.
What exactly is the goal/requirement here? Maybe there are some other options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:26 AM
Hi Mike,
Thanks for the reply, im trying to allow time for a workflow to complete before the page refreshes
it's quite a long workflow takes a few seconds to complete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:37 AM
What kind of workflow is it, and why does it need to complete before refreshing? The workflow should run in the background so a refresh shouldn't have any impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:50 AM
cheers, it's an approval workflow for raising changes. i have a onload script that looks for conflicts in the change from the blackout calendar and if found it sets the change to emergency and notifications appear stating the change has been raised during blackout... however, because the workflow is taking a few seconds to complete there are no conflicts when the page first refreshes then a few seconds later notification of conflicts appear but my script is only on load so only refreshing it manually will show the correct notifications...
so basically i need to wait a few seconds for the conflict to appear on the change so when the page reloads the raiser is advised of the conflict and that the change has been set to emergency