On hold calculations on Incident ticket level

ar1
Kilo Sage

Hi All and @Ankur Bawiskar ,

Can anyone please help us on the below requirement issue.

1. On Incident table when we place the ticket On Hold and on hold reason is "Awaiting caller, Awaiting Evidence, or Awaiting vendor" we need to populate the future date/time in On Hold Date field.

2. And when an user changes the state from on Hold to other options OR on hold reason is to "Awaiting change or Awaiting problem "we need to clear the On Hold Date field.

For first scenario we wrote below before - update business rule with a condition as on hold reason is one of "Awaiting caller, Awaiting Evidence, or Awaiting vendor" and it's working fine in one way.

(function executeRule(current, previous /*null when async*/ ) {
 
    var timeZone = "America/New_York"; 
    var hours = 48;

if(current.state != previous.state)
    {
    var currDate= new GlideDateTime();
    var duration = new GlideDuration(3600000 * hours); //86000 Seconds in a day / 24hr in a day = 3600
  var schedule = new GlideSchedule('090eecae0a0a0b260077e1dfa71da828', timeZone);
    var releaseDT = schedule.add(currDate, duration );
    current.u_hold_release = releaseDT;
    }

})(current, previous);



But without changing the state from on hold, when we change the on hold reason to "Awaiting change or Awaiting problem " and it's clearing the On Hold Date field [Wrote another business rule for these and it's working fine ]

Then again, we change back the on hold reason to any one of the old options "Awaiting caller, Awaiting Evidence, or Awaiting vendor" the earlier old date/ time is not populating on on hold date field level

Note:
The new date/time is going populate on  On Hold Date field level only we rechange state again to on hold.


Advance thanks.




2 REPLIES 2

Peter Bodelier
Giga Sage

Hi @ar1 

 

Can you share the second business rule, and screenshots of the conditions as well?


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter,
Many thanks for the response.

Please find the below second BR conditions and scripts:

ar1_2-1699035364978.png



ar1_1-1699035318741.png

Thanks.