Adding Conditions to a Link Record in HP Service Manager
July 28, 2010
How to add conditions to your link record.
Lets say that you always want to always keep the phone number that is entered by the user for a particular ticket regardless of what is in the contact record. This may come about if you have a telephone number for a contact that is only applicable to that ticket. Lets take a look at how to do this.
First we want to save the old values, so in the pre fill expressions we will add:
$save.field=field in $File;
We would repeat this step for all the fields we are going to check if they have changed.
Next we need to add the conditional expressions in the post fill expressions. Don’t forget to cleanup your variables when you are finished:
if (field in $File ~= $save.field) then (field in $File=$save.field);
This will leave the fill value in the record unless it is different from the initial value, in which case it will replace the fill value with the saved value from the previous step.
Or you could use this technique to tie a particular type of telephone number to the priority of the ticket. Lets use the office number for low priority, and the cell for high priority. First we add variables in place of the “fill to” values (where the field on the form would usually be located) for all the phone numbers we might use.
fill to fill from
Then in the post fill expressions we need to add code to use the correct telephone number based on the value of priority (always cleanup your used variables)
if (priority in $File=”low”) then (contact.phone in $File=$work.num);
if (priority in $File=”high”) then (contact.phone in $File=$cell.num);
This same technique could be used in a variety of ways including conditional fill of other fields based on certain fill values or even modifying the values that are being generated by a fill. Although the code we used is rather simple, it is powerful and indeed a valuable tool in Service Manager.