Clarity Service Management

Expand all | Collapse all

SDM Requests - Set Priority based on category_urgency

Jump to Best Answer
  • 1.  SDM Requests - Set Priority based on category_urgency

    Posted 02-13-2018 04:47 PM

    SDM 14.x

     

    Customers have the flip Incident <> Request customization and are not using Priority Calculation at this time for that reason.

     

    The requirement being tested is that the default Priority for a Request should be '3' - when submitted by an Employee role via the detail_cr.htmpl.  The Priority is hidden on the form.  This is set via Data Partition.

     

    However, the exception is when the Category has a value on the category_urgency field. We then need to set Priority based on some criteria (in development).  For this test, we need to set the Priority to '5' when the category_urgency is '0'.

     

    My approach was to modify the emp_change_category_func() which is called by the onChange() event on the Category selection on the form. ( I'm not considering SPEL triggers at this time as it requires system restarts, but may later. )

     

    I cannot seem to get the [category.category_urgency] based the Category selected which fires the event.

     

    I get the persid using:

     

    var cat_persid = document.forms["main_form"].elements["SET.category"].value;

     

    and the sym using:

     

    var cat_sym=document.getElementsByName("KEY.category")[0].value;

     

    The category_urgency isn't currently captured as part of the form, and would be empty anyway during initial ticket creation.

     

    Is this a valid approach and I'm missing some syntax or is there a better way?

     

    (I need a refresher on the use of SET, KEEP, and KEY in context of the main form and passing to functions!)

     

    TIA,

     

    J.W.



  • 2.  Re: SDM Requests - Set Priority based on category_urgency

     
    Posted 02-14-2018 01:27 AM

    My initial reaction is that a spel trigger is probably the better way to go.  However, for a Javascript solution, one way to access the category_urgency would be to use PDM_LIST early in the form, with a where clause, to build a Javascript array of all categories that have a non-null urgency, with a parallel array of their urgencies, from which your function can look up the urgency when needed.

    Hope that helps,

    Regards,

    James



  • 3.  Re: SDM Requests - Set Priority based on category_urgency

    Posted 02-14-2018 11:41 PM

    Thanks, James.  I'll look into the PDM_LIST.

     

    In the meantime, I started on SPL to handle this as DEV has become available.

     

    I can get the category.category_urgency but I can't seem to filter my condition to only the self-service interface .

     

    zPCAT_Urg.mod file:

     

    OBJECT cr {
         TRIGGERS {
            POST_VALIDATE zPCAT_Urg() 20005 FILTER( EVENT("INSERT UPDATE") && category {} ) ;
        } ;
    } ;

     

    zPCAT_Urg.spl file:

       

    // Setting the request priority based on the category_urgency field and from self-service interface

     

     

    cr::zPCAT_Urg(...) {
        if (category.category_urgency == 0  && created_via == 3570)
        {
            send_wait(0, this, "call_attr", "priority", "set_val", 0, "SURE_SET");
            if (msg_error()) { 
                logf(ERROR, "Object was not updated %s", msg[0]);         
                return;
            }
        }
    }

     

    I've tried setting created_via in the MOD file as well.  I've also tried using the code "WEBSELFSVC".

     

    The trigger is firing for both the self-service and analyst web interfaces.  Otherwise, it is working as expected.

     

    NOTE:  This test is limited to setting priority to enum '0' if category_urgency enum is '0'.

     

    J.W.



  • 4.  Re: SDM Requests - Set Priority based on category_urgency

     
    Posted 02-15-2018 12:30 AM

    I wonder if firing POST_CI with filter including '&& created_via == 3570' would differentiate between the self-service and analyst interfaces?



  • 5.  Re: SDM Requests - Set Priority based on category_urgency

    Posted 02-15-2018 02:43 PM

    James,

     

    Turns out jmayer was on the right track.  I forgot the use case was for both initial and update tickets.  The created_via only captures the interface on the initial save.  Once created, it never changes.  (I've been doing too many reports instead of coding) 

     

    thanks,

     

    J.W.



  • 6.  Re: SDM Requests - Set Priority based on category_urgency
    Best Answer

    Posted 02-15-2018 02:10 AM

    Hi,

    the below may give what you are looking for by retrieving interface used by currently logged user.

     

    cnt::get_login_user_interface_type());

     

    Hope this help

    /J



  • 7.  Re: SDM Requests - Set Priority based on category_urgency

    Posted 02-15-2018 02:55 PM

    Thanks, Jerome.  This was exactly what I needed.  See my reply to James above.

     

    Here are the working examples:

     

    zPCAT_Urg.mod

     

    // Check when a ticket is created or updated and the category is changed

    OBJECT cr {
         TRIGGERS {
            POST_VALIDATE zPCAT_Urg() 20005 FILTER( EVENT("INSERT UPDATE") && category {} ) ;
        } ;
    } ;


     

    zPCAT_Urg.spl

     

    // Setting the request priority based on the category_urgency field when from self-service interface
    // This use case is to check for an urgency of '0' (1- When Possible) and set Priority to '0' (5 - Under Review)
    //
    cr::zPCAT_Urg(...) {
        int iInterface;
        iInterface = cnt::get_login_user_interface_type();
        //logf(SIGNIFICANT, cnt::get_login_user_interface_type());
        // The self-service interface value is '1'.  The web (analyst) interface is '3'
        if ( (category.category_urgency == 0) && (iInterface == 1)  )
        {
            send_wait(0, this, "call_attr", "priority", "set_val", 0, "SURE_SET");
            if (msg_error()) {  
                logf(ERROR, "Ticket was not updated for: %s", msg[0]);          
                return;
            };
        };
    };