Share This:

We cannot directly increment a value upon save via the user interface, but we can use a script delivered via escalations to perform the task.

 

In this scenario I am going to create a field to see how many time a ticket was edited.

So upon each save we will increment the value by one.

 

Step 1.

Administration > Workspace > Form Designer

Create new field on Form to act as counter - Integer field called -  "Counter"

 

 

Publish

 

 

Step 2

Copy the attached script file (mrSetIncrementOfIntField.pl) that will be used in escalation to the Footprints application server

 

Copy the file to the C:\FootPrintsServiceCore\cgi folder -- change location if needed to your installation path

 

Step 2

 

Create escalation rule to increment counter

 

Administration > Workspace > Escalation

Add Escalation

 

This will be an Instant Escalation - configure as screenshot below

 

 

 

When to Run:

Escalation Type: Instant Escalation

Instantly escalate Issue after it has been create and/or edited?

Tick box to enable - Instant Escalation upon editing of issue

                            - select Create/edit can be either an agent or a customer

 

Check box -Re-escalate Issue if it still matches criteria after already being escalated by another Escalation. This allows for multiple Escalations rules to be run on a single Issue without any user intervention between them. If this is checked, this Escalation rule will only act once, ever, on a given Issue.

 

Issue Criteria:

 

Select your open statuses - in this example I have Open and Request

 

Actions

 

Scroll to bottom and set External Action

 

Enter the external program value as below:

 

C:\FootPrintsServiceCore\bin\perl\bin\perl.exe C:\FootPrintsServiceCore\cgi\mrSetIncrementOfIntField.pl %%MRID%% Counter 1 %%PROJID%%

 

this translates as

Path to Perl.exe --> path to script --> Issue number --> Field Name --> Increment value --> Workspace number

 

 

This is setting the value of the "Counter" field and adding 1 to the value

 

Save / Run

 

 

Set Escalation name as:

Increment Counter

 

 

Now to test!

 

Create a new Issue

 

Do not enter anything in "Counter Field"

 

 

Save

 

 

Now edit Issue, but do not put anything in Counter field - Save

 

 

Now if we look at the issue in details mode

 

 

We can see Counter has a value of 1

 

History tab show the escalation has run.

 

 

 

So there we have it a way to increment a value upon each save.

 

 

So let's edit the test ticket again to make sure it works.

 

After editing let's go to the Details of the ticket.

 

 

The Counter has not been incremented and the History shows the escalation has not run

 

 

 

So what is wrong?   Why has it not run a second time?

 

We need to go back to Step 2 - creating the escalation rule to see the reason.

 

On the When to run tab we selected:

 

Check box -Re-escalate Issue if it still matches criteria after already being escalated by another Escalation. This allows for multiple Escalations rules to be run on a single Issue without any user intervention between them. If this is checked, this Escalation rule will only act once, ever, on a given Issue.

 

 

We need this to be enabled in case any other escalation rule has run on the issue - but we then hit the problem  " If this is checked, this Escalation rule will only act once, ever, on a given Issue."

 

So how do we make the system run the escalation more than once?

 

 

We have an MRlocalDefs variable that will allow you to have the Re-escalate checkbox checked, and still have the escalation run every time a ticket is edited and meets the escalation criteria:



A) The c:\FootprintsServicecore\cgi\MRlocalDefs file needs to be edited. Make a backup copy of this file.

 

B) Now open the MRlocalDefs file in a text editor such as notepad or WordPad.


C) Insert the following variable on a line by itself:


$MULTIPLE_RECURRING_INSTANT_ESCALATIONS[x][y] = 1;   ##   x is project number  - y is escalation number

 

D) Ensure this line is above the current last line of the file which currently has a "1;"

 

     and should be below the line that has:

 

     ### Location of footprints root directory ##################################

 

E) Then save the file.

 

For example if the workspace is 103 and the escalation is 9 we would set:

$MULTIPLE_RECURRING_INSTANT_ESCALATIONS[103][9] = 1;

1;

 

 

To find the workspace number go to Administration > System > Workspaces

 

In the List All Workspaces section, Click on the Click here link to see the Workpace number

 

To Find the escalation id required - go to:

 

Administration > Workspace > Escalations

 

In the bottom right corner - click on the link Summary of all Escalations

 

 

Once the page loads: Search for the escalation name  (CTRL+F)

 

In my case it was "increment Rule)

 

Once found the rule name should have an ID number next to it:

 

 

In this example it is ID:3

 

My workspace is 5 so my MRlocaldefs variable should be:

 

$MULTIPLE_RECURRING_INSTANT_ESCALATIONS[5][3] = 1;

 

 

Once we have the variable configured and saved - when we next edit the issue the value of the Counter will be increased.

 

History Tab shows rule is running again:

 

Counter is now at 2

 

 

 

Hope this helps.