UI Action Visibility
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 06:01 AM
Hello Folks,
I have a requirement I want to hide button from incident form for next 24 hours once clicked it and after 24 hours again its visible or abort action if user click it within 24 hours once he click first time. I tried to use below code in ui action script but its not working.
var diffInHours = gs.dateDiff(lastClicked, gs.now(), 'hours');
if (diffInHours < 24) {
return false;
}
Much Appreciated!!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 07:49 PM
you will require some field to hold the time when it was clicked last time.
When it's 1st time the field will be empty so show always.
From next time onwards you can use UI action condition to compare that
current.custom_field == '' || (Script Include code and pass the custom field and check difference)
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