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.

Nick Daigneau
ServiceNow Employee
ServiceNow Employee

Task Plan Templates are one of the most impactful features for streamlining case management in ServiceNow. As discussed in the below video, these templates allow process owners to predefine sets of tasks that can be applied to cases based on specific conditionsโ€”saving time, improving consistency, and enhancing visibility across workflows.

 

 

โœ… Benefits of Task Plan Templates:

  • Accelerated case handling: Automatically apply relevant tasks based on case type or attributes.
  • Improved visibility: Hierarchical task structures make it easier to track progress and dependencies.
  • Scalability: Easily adapt to changing business rules without manual reconfiguration.
  • Empowered process owners: Configure and manage task plans directly from the native workspace UIโ€”without relying on admin-level intervention or backend changes.

๐Ÿ’ก Automating Task Plan Invocation with Business Rules

While Task Plan Templates can be triggered manually, many organizations prefer a systematic approach to ensure consistency and reduce manual effort. One effective method is to use a Business Rule to invoke the template automatically when certain conditions are met.

 

Example Scenario:

Youโ€™ve created a Task Plan Template for a specific FSO case type (e.g., Personal Auto Claim).

NickDaigneau_0-1759683848430.png

This task plan will be invoked when the Stage on a Personal Auto Claim case is โ€˜FNOLโ€™.

NickDaigneau_1-1759683879657.png

Once the condition has been met, four new tasks will get created for the given case.

NickDaigneau_2-1759683899539.png

To automate the creation of tasks when the case stage changes, you can create a Business Rule with the following configuration:

  • Table: Personal Auto Claim (or your relevant case type)
  • When to Run
    • When: after
    • Insert: True
    • Update: True
    • Filter Conditions: Stage (changes)

NickDaigneau_3-1759683933737.png

  • Advanced

(function executeRule(current, previous /null when async/ ) {

 

    var array = new sntaskplan.TaskPlanExecutionService().findMatchingTaskPlanTemplate(current);

    var latestRecord = null;

    var latestDate = null;

 

    for (var i = 0; i < array.length; i++) {

        var currentRecord = array[i];

        var currentDate = new GlideDateTime(currentRecord.sysupdatedon);

 

        if (latestDate === null || currentDate.getNumericValue() > latestDate.getNumericValue()) {

            latestDate = currentDate;

            latestRecord = currentRecord;

        }

    }

    new sntaskplan.TaskPlanExecutionService().applyTaskTemplate(latestRecord.sys_id, current);

 

})(current, previous);

NickDaigneau_4-1759683999447.png

Once this is activated, the set of tasks defined in the Task Plan Template for this case type will now get systematically created as seen below.

NickDaigneau_5-1759684019140.png

๐Ÿง  Why This Matters

Automating Task Plan Templates means the system can intelligently generate and apply task plans based on criteria defined at the template levelโ€”without requiring agents or admins to manually trigger them. This:

  • Reduces manual effort and human error.
  • Ensures consistent task execution across similar case types.
  • Enables faster response times and better scalability.

๐Ÿ’ฌ Join the Conversation

Have you implemented Task Plan Templates in your organization? What automation strategies have worked best for you? Share your experience or questions below!

Comments
Pascal Pailloc1
Tera Explorer

Hello,

Thanks for your post!

We noticed a few issues with the Business Rule. Thanks to Lmouity1, hereโ€™s a suggested fix:

(function executeRule(current, previous /*null when async*/) {
     var array = new sn_task_plan.TaskPlanExecutionService().findMatchingTaskPlanTemplate(current);
    var latestRecord = null;
    var latestDate = null;
    for (var i = 0; i < array.length; i++) {
        var currentRecord = array[i];
        var currentDate = new GlideDateTime(currentRecord.sysupdatedon);
        if (latestDate === null || currentDate.getNumericValue() > latestDate.getNumericValue()) {
            latestDate = currentDate;
            latestRecord = currentRecord;
        }
    }
    new sn_task_plan.TaskPlanExecutionService().applyTaskTemplate(latestRecord.sys_id, current);
})(current, previous);

Let us know if it works for you or if you need further clarification

Version history
Last update:
โ€Ž10-05-2025 11:14 AM
Updated by:
Contributors