Add delay to my ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 04:15 AM
Hi,
I have an ui action which creates a new task. Now once its clicked it takes a few seconds for the task to get created. Now if the user clicks multiple times on the ui action at the same time then it creates multiple tasks. So i need to deactivate my ui action or add a delay of maybe 10 sec before it can again be clicked. How can this be achieved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 05:21 AM
I don't think you can control it.
You will have to train your users/agents.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 07:25 AM
Hi @MaharshiC ,
Only one task should be created when the UI action is clicked?
why not hide it if a task is already exist(once ui action is clicked and task has been created)?
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 11:04 PM
Hi @Chaitanya ILCR ,
Yes we are hiding it but the problem is that they are clicking multiple times at the same moment and not waiting for the task to get created and the page to load. I need to find a way to disable the u action for some time once its clicked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 11:28 PM
Try to hide UI action in onClick Function, make it a combo of client and server.
Use DOM in onClick Function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 11:43 PM
Hi @MaharshiC ,
the creation of new task how much is it gonna take?
is there any integration of something which is taking time to create the task?
if no the button will be hidden instantly
if the task creation takes time
you can go with below approaches
1. create an field(checkbox) as soon as the button is clicked update the checkbox as true and add condition that checkbox is not = true (useful when multiple users are expected to work on same form at the same time)
2. Store Session data gs.getSession().putClientData() and getClientData methods To store the value like whether the button is clicked or not and use those values(useful if only one user is expected to work on the form at a time)
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya