CA Service Management

Expand all | Collapse all

Different Default Priority Value for Request & Incident

  • 1.  Different Default Priority Value for Request & Incident

    Posted Dec 16, 2016 01:22 AM

    Hi Team,

     

    I am using CA SDM 14.1.03 with SQL Server 2008 R2 on Windows Server 2008 R2. I am using a customised mod file with the following content:

    MODIFY cr priority { ON_NEW DEFAULT 3 ; } ;

     

    Using this, the default value of priority for both request and incident is coming of "Medium Priority" (instead of out of box default "Unassigned" priority of value 0).

     

    I want to implement a scenario in which the default value of priority for incident should come different from the default value of priority for request.

     

    How it can be achieved?

     

    Kindly provide the solution for this.

     

    Thanks & Regards,

    Balram



  • 2.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 16, 2016 04:58 AM

    Hi Team,

     

    Kindly provide updates on this.

     

    Regards,

    Balram



  • 3.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 16, 2016 05:44 AM

    Hi cdtj, Gutis

     

    Kindly provide your valuable feedback on this.

     

    Thanks & Regards,

    Balram



  • 4.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 01:41 AM

    I don't have a setup to test this for you so you'll have to do the dirty work yourself, but try these and see if they help you:

    1. Write a second object modification but for the in factory: MODIFY in priority { ON_NEW DEFAULT someothervalue ; } ;

    2. If the first doesn't work you can try writing a SPEL trigger, either object or attribute level, and have it return the value you want on insert for the factory being used. This is going to be more complex and I won't even try to estimate the possible impact on the performance so let's hope the first part works so you don't have to explore this one

     

    Keep us updated, I'm interested in hearing how it turns out.



  • 5.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 02:22 AM

    Hi Jussi,

     

    Thanks for your response on this. I tried this second object modification earlier but it is not working. It overrides the default priority of cr object also and the value comes same for both incident & request.

     

    I am able to achieve this functionality using the following line of code in detail_in and it is working now. Here is the code snippet:

     

    function loadActions()
    {
    if ( _dtl.edit ) {
    if ("$args.priority" == current_default_value_required_for_request)
    {
    document.main_form.elements["SET.priority"].value=new_default_value_for_incident;
    }
    //Form should retain the context for the status field in case change in status was done prior to save and save failed.
    if(typeof "$args.old_status" != "undefined" && "$args.old_status" != "" )
    {
    window.document.main_form.elements["SET.status"].value = "$args.old_status";
    var setinp=window.document.main_form.elements["SET.status"];
    setinp.value="$args.old_status";
    set_default_toggle(setinp);
    }

     

    This will take effect every time the incident will be in edit mode. The only limitation with this code is that, if the user provides the default value of request priority to his incident and goes for editing of the incident, the priority of incident will be changed to the default value of the incident priority. He needs to reassign the default request priority again during incident modification.

     

    Thanks & Regards,

    Balram



  • 6.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 02:30 AM

    To set the default value for priority in an incident, you might be better to set defaults for Impact and Urgency and let the priority calculation sort it out.

     

    Or, you could add this to both detail_cr and detail_in:

    if ("$args.type" == "R" && "$args.priority" == "")
    {
       document.main_form.elements["SET.priority"].value=new_default_value_for_request;
    }

    if ("$args.type" == "I" && "$args.priority" == "")
    {
       document.main_form.elements["SET.priority"].value=new_default_value_for_incident;
    }

     

    ...but the weakness of setting the default in the form is that the default won't apply if a ticket is raised by maileater or through web services.

     

    Cheers,

    James



  • 7.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 03:47 AM

    Hi James,

     

    Thanks for this code snippet. It is working for all conditions.

     

    As per your suggestion to set defaults for Impact and Urgency, should I use spel code for that? My requirement is to use different default priority for both incident and request. How it can be achieved using Impact and Urgency (Not on form level)? Kindly share the relevant spel code for this.

     

    Regards,

    Balram



  • 8.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 09:57 PM

    You can set the defaults for Impact and Urgency for an Incident (or Problem) in the Priority Calculation matrix, and that will cause the Priority calculation to set the priority for an Incident (or Problem, if you configure it so) from the default Impact and Urgency.

    The matrix below, setting default Impact and Urgency to 'Low' and 'When Possible', will set the default Priority for an Incident or Problem to 4:

    Sample priority matrix

     

    To set the default priority for a Request you're probably better to use a Data Partition rather than spel, as a Data Partition is visible from within the Administrator interface, whereas spel is less visible in site\mods.  And a Data Partition takes effect without a restart.  To apply this across the system you will need to add the following Default constraint to every active Data Partition, and also make sure that every Role has a Data Partition assigned:

    If you didn't have priority calculation configured, this would also set the priority for Incidents and Problems, but the priority calculation, if configured, takes precedence.

     

    Cheers,

    James



  • 9.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 21, 2016 12:02 AM

    Thanks James for your support.

     

     

    Regards,

    Balram



  • 10.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 02:39 AM

    Oh, if you're just looking for the defaults to work for human users then the form level is much easier and flexible to implement, I thought you were going for the system-wide approach. Carry on then



  • 11.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 19, 2016 03:49 AM

    Hi Jussi,

     

    Do you have any alternative way so that it can be applied for the system-wide approach instead of form level approach?

     

    Thanks & Regards,

    Balram



  • 12.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 20, 2016 02:01 AM

    Hi Balram,

    The following solution works on the object level so it should be more or less system-wide. For some reason it works perfectly with requests and incidents but not for problems, you'll have to sort out the problem issue yourself or just remove the problem part and be happy with it

    So two files, the usual mod and spl files.

    zdefault_pri.mod:

    MODIFY cr priority ON_POST_VAL zreset_priority_default() 69 FILTER( EVENT("INSERT") );

    zdefault_pri.spl:

    cr.priority::zreset_priority_default(...) {
        logf(MILESTONE, "cr::zreset_priority_default(): Started");

     

        // Debug logging the argv
        int i, default_priority;
        for (i = 0; i < argc; i++){
            logf(VERBOSE, "argv[%s]: %s", i, argv[i]);
        }
        logf(VERBOSE, "type: %s", type);
        
        if (sindex(type, 'R') > -1){
            default_priority = 1;
        }
        if (sindex(type, 'I') > -1){
            default_priority = 3;
        }
        if (sindex(type, 'P') > -1){
            default_priority = 5;
        }

     

        logf(VERBOSE, "Type is '%s', defaulting priority to %s", type, default_priority);
        priority = default_priority;
    }



  • 13.  Re: Different Default Priority Value for Request & Incident

    Posted Dec 21, 2016 12:02 AM

    Thanks Jussi for the codes. I will test them and let you know of the results.

     

    Regards,

    Balram



  • 14.  Re: Different Default Priority Value for Request & Incident

    Posted Apr 13, 2017 01:13 PM

    Hi Balram.Deswal,

    Please check the below link. It might help.

    How to set separate default priorities for each Request, Incident and Problem? 

     

    Thanks

    Manirul