Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Add a duration to a duration field

SOLVED
Go to solution
Highlighted
Samuel_22
Occasional Contributor

Add a duration to a duration field

Hello !

Configuration: OVSD v4.5, SP11.

I would like to manage 'non-accountable' status, like 'Waiting Customer'. For the moment, Service desk doesn't handle a Deadline update for the time during which the Service call has been in the 'non-accountable' state.

I created two custom fields:

# Waiting date (date)
# Waiting duration (duration)

I created two UI rules:

1) When the status Waiting Customer is selected:

Waiting date set to (Current date)

2) When the status changes from Waiting Customer to an 'accountable' status:

Waiting duration set to (Substract date from (Current date) With [Waiting date])

The problem is: if the status is changed more than once, the Waiting duration is overwritten by the latest value.

I would have liked to do this:

Waiting duration = Waiting duration + (Substract date from (Current date) With [Waiting date])

However, I don't find the operator to ADD a duration to a duration field. There is only SUBSTRACT.

Thanks for the help.

Best regards,

Samuel Chenal.
9 REPLIES
Aykut Guven
Collector

Re: Add a duration to a duration field

Hello Samuel,

I did not check if there is really only substract but if it is so why do not you try the following formula like,

Waiting duration = Waiting duration - (Substract date from (Current date) With [Waiting date])

Result will be minus instead of positive.


UPS
Samuel_22
Occasional Contributor

Re: Add a duration to a duration field

Hello Aykut,

Thanks for your proposition.

Actually, the date and duration functions seem to be limited.

I think that it is impossible

- to add (or substract) two duration fields to a third duration field.
- to add (or substract) a duration field to a date field.

It is only possible to substract two date fields into a duration field...

Could you check it?

If the rule is triggered more than once during the call life cycle, the duration field is overwritten.

Any other idea?

Thanks,

Samuel Chenal
Aykut Guven
Collector

Re: Add a duration to a duration field

Hello Samuel,

No way for doing what you have wanted to do. I have to do something similar for a project but the tool could not have enough intelligence. Only way seems to me that coding a jsp and using "Data Update from External System"

If you can find a solution please inform me and let' s cross our fingers by hoping HP would add some functionality to the tool to solve these kinds of simple issues.
UPS
George M. Meneg
Honored Contributor
Solution

Re: Add a duration to a duration field

Samuel,

There is a drastic solution to your problem but it is based on a "bug", it is unsupported and you won't be sure that the solution will work to the next version. If you are willing to take the risk...

You will need a 40bytes custom text field and a second custom duration field. You will also need a number to be defined.

Let's call the second custom duration field "temp_duration" and the custom text field "new_waiting_duration"

Set temp_duration to Substract date from (Current date) With [Waiting date]) as first update action.

At the second update action select a number. Set it to temp_duration + waiting_duration. Before pressing "Add to list" change the number to "temp_duration". Press add to list. The temp_duration will contain the number you want.

You can have a report based on it's value but you cannot present it as "duration" in service desk forms. I know it's not perfect but it works.

But I would also create a ER for HP to fix the limitation.
menes fhtagn
George M. Meneg
Honored Contributor

Re: Add a duration to a duration field

Samuel,

I got it right this time. I wrote

>At the second update action select a number.
>Set it to temp_duration + waiting_duration.
>Before pressing "Add to list" change the number
>to "temp_duration". Press add to list. The
>temp_duration will contain the number you want.

The right thing to do is
At the second update action select a number. Set it to (temp_duration + waiting duration) (you can do that). Then, before pressing "Add to list" change the number field to "waiting duration" BY *TYPING* it (and not selecting it from the pull down menu). Then press add to list and voila :)
menes fhtagn
Samuel_22
Occasional Contributor

Re: Add a duration to a duration field

Hi George,

Thanks very much for this interesting solution ;-)

It works quite perfectly, but I had to adapt your proposition a little bit.

Creation of three custom fields (WFC means Waiting For Customer):

# WFC Date (Date)
# WFC Temp Duration (Duration)
# WFC Duration (Duration)

Then, three UI rules:

1) IF WFC Date is Empty
AND Status has changed to Waiting For Customer THEN
WFC Date SET TO Current Date;

2) IF Status has changed back to another status
AND WFC Date NOT Empty
AND WFC Duration IS Empty THEN
WFC Duration = Current date - WFC Date
WFC Date SET TO Empty;

3) IF Status has changed back to another status
AND WFC Date NOT Empty
AND WFC Duration NOT Empty THEN
WFC Temp Duration = Current date - WFC Date
WFC Date SET TO Empty;

And one DB rule:

a) IF WFC Temp Duration NOT Empty THEN
WFC Duration = WFC Duration + WFC Temp Duration
WFC Temp Duration SET TO Empty;

Three comments:

- I didn't use the 40bytes text field (I don't understand its role).
- I wasn't able to add a duration to a duration field that was blank (I had to create the 2nd UI rule).
- It was quite complicated to make this solution work without a DB rule (difficult to explain why...).

Quite easy, isn't it?!

Now this solution works and replaces (workaround) the non-functionality of HP (non-accountable state of the Waiting Customer status).

Thanks again!

Samuel Chenal
Brendan_22
Member

Re: Add a duration to a duration field

I may be missing something, but I can't find any custom fields of type Duration. I have even had a look at Calculated fields but these don't allow you to subtract a variable field. I think it would be great if hp included this functionality but in the absence of that, I would like to try the workaround suggested by Samuel.
Samuel_22
Occasional Contributor

Re: Add a duration to a duration field

Hi Brendan,

Your message:

"I may be missing something, but I can't find any custom fields of type Duration. I have even had a look at Calculated fields but these don't allow you to subtract a variable field. I think it would be great if hp included this functionality but in the absence of that, I would like to try the workaround suggested by Samuel"

-------------------

You are right. There is not custom field of type Duration. Actually, there is a trick. You have to choose a custom field of a type Number. But not all Number custom fields behave the same way... Check the Display format. I attached a screenshot of one of my Number / Duration custom fields.

Regards,

Samuel.
Eric Ung
Frequent Visitor

Re: Add a duration to a duration field

Samuel,

Sorry to drag you back to Aug'05 but can you explain how you archive the addition function in your DB Rule. I am using 4.5 SP17 and there is only a Subtraction function.

WFC Duration = WFC Duration + WFC Temp Duration

Thanks
//Add this to "OnDomLoad" event