How to configure clocks for Incident Tasks using macros

  • KM03166579
  • 24-May-2018
  • 25-May-2018

Summary

This document provides the steps to get the macros of type start and stop clock working in a Process Designer system

Question

Currently in a system with Process Designer enable, there is no way to configure macros for Incident Task, how can we enable macros to start/stop clocks in Incident Tasks? 

Answer

In OOB systems with Process Designer enable we can start or stop clocks by using RuleSets only, however, we can use macros for Incident Tasks records by performing some changes in the system.  Please follow these steps to get this working:

*Modify the Macro Forms to Include imTask*

1-Login as Admin to the windows client
2-Type "fd" in the SM command line to open the forms designer
3-Search the form called "macro.edit.form.new.g"
4-Click "Design" button
5-Select the field "Applies When"
6-Look for the "Value List" property in the properties table
7-Add "imTask" in the "Value List" property
9-Look for the "Display List" property in the properties table
10-Add "Incident Tasks are Saved" in the "Display List" property
11-Click Ok and save the changes
12-Repeat steps 2 to 11 for the form "macro.edit.form.g"

*Create the macro to start the clock*

1-Type "macros" in the SM command line
2-Click add button
3-Fill the Information as follows:

*Macro Name: Start Assignment Group Clock
*Applies When: Incident Tasks are Saved
*Macro Type: Start A Clock
*Macro Condition: assignment in $L.new~=assignment in $L.old

4-Click "Set Parameters" button
5-Configure the macro as follows:

*Name of Clock: Select "Evaluating Expressions"
*Name Expressions: assignment in $L.new
*Type of Clock: Select "Fixed Type"
*Fixed Type: imTask
*Clock Key Field: Select "Fixed Key Field"
*Fixed Key Field: id

6-Click Save and then Ok

*Create the macro to stop the clock*

1-Type "macros" in the SM command line
2-Click add button
3-Fill the Information as follows:

*Macro Name: Stop Assignment Group Clock
*Applies When: Incident Tasks are Saved
*Macro Type: Stop A Clock
*Macro Condition: assignment in $L.new~=assignment in $L.old

4-Click "Set Parameters" button
5-Configure the macro as follows:

*Name of Clock: Select "Evaluating Expressions"
*Name Expressions: assignment in $L.old
*Type of Clock: Select "Fixed Type"
*Fixed Type: imTask
*Clock Key Field: Select "Fixed Key Field"
*Fixed Key Field: id

6-Click Save and then Ok
7-Logout and log back in so the changes will take effect

*Create the Process Record to execute the macros*

-Go to Tailoring >Document Engine >Processes
-Set the Process Name field to "Incidents.Task.Clocks"
-Go to RAD tab and add the following information:

*RAD Application: macro.execute
*Condition: true

Parameter Names Parameter Values
index 150
second.file $L.file.save
file $L.file

*RAD Application: macro.execute
*Condition: true

Parameter Names Parameter Values
index 151
second.file $L.file.save
file $L.file

NOTE:  The value of the RAD application "index" parameter belongs to the macro ID, you can check the ID in the macros section and change the values to the correct ones. 150 is the Macro to Start the Clock and 151 to Stop it.

8-Click Add

*Create a RuleSet to call the Process*

1-Go to Tailoring >Process Designer >Rulesets
2-Click "New" button
3-Set the "ID" and "Name" fields to "Start/Stop imTask Clocks"
4-Set the "Table Name" field to "imTask"
5-Click Save
6-Click "Add Rule" button
7-Select "Call A Process" RulseSet type from the list
8-Select the Process "Incidents.Task.Clocks" in the Process Field
9-Click Ok and then Save

As final steps, add the RuleSet created into the imTask workflow specifically inside the WorkFlow Propeties RuleSets "On Add" and "On Update".

The reason of create the process record and RuleSet is because the system does not assign the right value to the $L.new and $L.old variables causing the macro to fail. Using the process we are giving the value of $L.file and $L.file.save which means $L.new will be equals to $L.file and $L.old will be equals to $L.file.save