Skip navigation
Share:|

Introduction

How to know if there are linked Tasks for an Incident?

What does the BMCServiceDesk__AllTaskCloseController__c field do, how does it work when there are no Tasks for any Incident?

How to prevent the Incident record being set to a specific status such as Resolved if there is any OPEN Linked Task to it?

 

If these questions are in your mind, then read on. I hope, with this post you will find some of the solutions for your issues.

 

Before we start on solution, I would like to talk about the following field:

 

Field name: All Tasks Closed Controller

API name: BMCServiceDesk__AllTaskCloseController__c

Type: Checkbox

 

Well, this field as the name suggests is set to True when all the Tasks linked to the Incident are CLOSED (or in any Status which has State = CLOSED). No brainer, seems simple and logical. Where is the problem? The problem is often encountered when you want to deal with the records which do not have any Task linked to it. And when that is the case, this field never sets to True. So if you are wanting to write your logic based on this field to do some validation etc., it will work only for those records which has Linked Tasks to it, else the validation wouldn’t work and that’s the problem we will see how we can solve.

 

So as we see in general we have two primary needs:

NEED 1: Getting any Validation rule to work not only for records which has Linked Tasks, but also to work for those which do not have Linked tasks.

NEED 2: Getting the count of Linked Tasks on Incident as a field to create simple validations or reports.

 

 

Solution for NEED 1:

 

Example Use Case: You want to prevent any Incident to be set to RESOLVED status if there are any OPEN Linked Tasks to it. For the records which do not have any linked task, you don’t want to restrict.

If the need is just to write an intelligent validation rule on Incident where BMCServiceDesk__AllTaskCloseController__c itself is insufficient to cater to the need.

This can be solved by using a validation rule which uses the combination of AllTaskCloseController and VLOOKUP to determine if there is any Linked Task:

Use the following criteria in the validation rule:

AND ( BMCServiceDesk__Status_ID__c = 'RESOLVED',

NOT(BMCServiceDesk__AllTaskCloseController__c),

NOT (ISNULL(VLOOKUP( $ObjectType.BMCServiceDesk__Task__c.Fields.BMCServiceDesk__FKIncident__c ,

$ObjectType.BMCServiceDesk__Task__c.Fields.Name,  Id )) )

)

 

Image: Validation Rule

 

 

 

 

 

 

 

Solution for NEED 2:

 

Example Use Case: Getting the Count of linked Tasks on the Incident to get it in Console List View, Quick View or a Incident Report.

This can be achieved by adding two Custom Fields and a Workflow:

 

Step 1: Add the two custom fields

 

The Custom Fields

 

Field Name

Create in Object

Field Type

Details

1

Is Task

Incident Manifests

Checkbox

Default False

2

Tasks Count

Incident

Rollup Summary

Rollup on “Is Task” field of “Incident Manfiests” object. See Image: Rollup summary details

 

Image: Roll-up summary field details

 

 

Step 2: Add a workflow with field update action

The Workflow

 

Workflow Object

Name

Rule Criteria

Action

1

Incident Manifests

Set IsTask

BMCServiceDesk__FKTask__c != NULL

Field Update Is Task = True

See Images: Workflow Screen 1, 2

 

 

 

Image: Workflow Screen 1

 

 

 

Image: Workflow Screen 2 (Field Update Action)

 

 

Notes:

  1. Do not forget to activate the workflow after creation
  2. As this calculation of rollup summary depends on the new fields on Incident manifests, it will only show correct values for the new linked Tasks getting created after you created this configuration. The existing Tasks do not covered in the Rollup summary as the "Is task" field is still set to false for those records.

However, you can get creative and follow these steps to for calculation of the “Linked Tasks” count for existing Task records:

      • Modify the Evaluation criteria to “Create and every time it is edited”.
      • Add a temporary field – “Dummy” of checkbox type – default false
      • Using data loader or any other way update “Dummy” field of all records to set the value to True.
      • This will force the workflow rule to fire and set the “Is Task” field correctly for existing records.
      • This will in turn reflect the right value of “Linked Task” rollup summary field in the Incident object.
      • Once you have the needful, delete the temporary Dummy field.

 

All the best!!!