Trigger an Sla based on a date

simaoG
Tera Contributor

Hi All,

I have a requirement where I need to trigger an SLA with Target = Resolution to ensure that it is triggered on the same date as the value of a variable (on catalog item) for example if i choose next monday  the Sla has to start on that specific date.

7 REPLIES 7

Jugmaz
Kilo Sage

It should work correctly when you just specify that Variable is after Today ?

Don't have anything to try now, but it should work that way - but the trigger.

perhaps start condition should not take it, but pause:
SO add pause condition there in a way that Variable date before Today? 

it might also need separate trigger to be doen (busienss rule or such) which will tell the SLA to start!

simaoG
Tera Contributor

i have tried your suggestion but nothing change here is my business rule can you tell if is it correct 

 

(function executeRule(current, previous /*null when async*/) {

        var catalogItemValue = current.catalog_item.u_due_date; // u_due_date is the variable

       var duration = new GlideDateTime(catalogItemValue);
      // duration.addDaysUTC();
       duration.addHoursUTC(12);

        var schedule = new GlideSchedule("U - 8-18");
        duration = schedule.whenNext(duration);


            current.sla.target = duration;

                  var slaName = 'Advens - Request P1 - GTR'; // the name of my SLA
                  var mySla = new GlideRecord('contract_sla');

                     mySla.addQuery = ('name' , slaName);
                     mySla.query();

                          if (mySla.next()) {

                             mySla.u_due_date = current.catalog_item.u_due_date;
                             mySla.duration = duration.getNumericValue();

                               gs.info("J'ai récupéré " + slaName + ", yesss !");

                         } else {

                          gs.info("Aucun Sla pour " + slaName);
                    }

   

})(current, previous);
 
the table is : sc_req_item 

 

No, you need to do it so that trigger is in the measured form.

in this case i believe it is RITM

so you might need to add custom field there which is the trigger

Business Rule will update that field when the due date is !?

OR, you can check Khiljis answer for ideas !?

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @simaoG ,

 

This will need some customization on the catalog level to decide when the the next monday is going to fall ? For this you can have a hidden variable called 'sla start time' (of type date and time). So when you select next month it will automatically set the ''sla start time'' field value onchange. 

 

Let say you select next monday on the dropdown, so the value will be updated on 'sla start time' as 29/04/2024 11.44.55. So your SLA will consider this date and time field for sla start.

 

You can use variables in condition builder in SLA definition. First, you need to click the last option on condition builder called "show related Fields" then it will allow you to select variables. see screenshot.

 

SohailKhilji_0-1713861522525.png

 

I hope this logic works ! 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect