We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

"Suspend Task" button on HR task in HR Agent Workspace

Nbruk
Tera Contributor

Hello,

 

"Suspend Task" button on HR task in HR Agent Workspace is missing.
How can I modify UI Action "Suspend Task", specifically Workspace Client Script to have the same functionality as on classic view? 
Thanks,
Nelli.
 
1 REPLY 1

SupriyaWaghmode
Kilo Sage

Hello @Nbruk 

Steps to  add the "Suspend Task" UI Action for Workspace:
  1. Locate the Action: Navigate to System Definition > UI Actions and find the "Suspend Task" action for the sn_hr_core_task table.
  2. Enable for Workspace: Ensure the Show in Workspace checkbox is checked.
  3. Configure for Client-Side:
    • Check the Client box.
    • Set the Onclick function name (e.g., runSuspendTask()).
  4. Create Workspace Client Script: In the "Workspace Client Script" field, implement the function to mirror the classic behavior, typically prompting for a reason and updating the state to Suspended. 
function runSuspendTask() {
    // Prompt for reason (optional: prompt the user for input similar to classic)
    var reason = prompt("Please enter the reason for suspension:");
    if (reason === null) return; // User cancelled

    // Set the state to Suspended (verify your system's 'Suspended' value)
    g_form.setValue('state', '3'); // Assuming '3' is Suspended
    g_form.setValue('work_notes', 'Task suspended. Reason: ' + reason);
    
    // Save the record
    g_form.save();
}

 

 

If my response helped you, please click on accepted solution and consider giving it a thumbs-up 👍. This helps others find the solution faster and keeps the community thriving.
Thank you for your support! 🙏
Thanks & Regards ,
Supriya Waghmode |ServiceNow Rising Star 2025🌟
www.linkedin.com/in/supriya-waghmode