CA Service Management

  • 1.  Preventing Closure of Parent Request with Child Incident

    Posted Sep 17, 2018 02:54 PM

    I've seen where people have created a macro that stops Analysts from closing parents with open children.  I'm looking for something similar, but have yet to find it. 

     

    I'm trying to create a way to stop Analysts from closing children Incidents on accident from a Parent Request or Incident. 

     

    So I have tier 1 staff who close Parent or children Requests all the time.   However, we create Incidents as children of Parent Requests who are the first to report a problem.  Tier 2 staff normally work these Incidents to completion, but we don't want Incidents to be closed automatically as Tier 2 could lose them and it would make their job harder. 

     

    Does anyone know of a way (without transitional statuses, just does not work for our multifaceted support) to stop an Analyst from closing a Parent Request where an open child Incident is attached.  Either a macro on the close event, or Spel code would work too. 

     

    Unable to figure this one out on my own.  Anyone have any suggestions?

     

    Thanks for viewing!

     

    John



  • 2.  Re: Preventing Closure of Parent Request with Child Incident

    Broadcom Employee
    Posted Sep 18, 2018 09:50 AM

    There is option "leave_children_open" in Options Manager that can control this.  This would prevent child tickets from being closed if the parent ticket is closed.

     

    Other than that, I don't think DP's would work here as the parent/child relation is a one to many relationship.  My thought would be to include java scripting to test for the existence of open children when a user tries to close a parent ticket.



  • 3.  Re: Preventing Closure of Parent Request with Child Incident

    Posted Sep 18, 2018 09:58 AM

    Yeah, we tried to use the leave_children_open option, but we want to keep the ability to close children Requests from parents.  Just don't want an incident to be closed on accident.  Sounds like JS would be the only answer. 



  • 4.  Re: Preventing Closure of Parent Request with Child Incident

    Broadcom Employee
    Posted Sep 19, 2018 01:31 PM

    cowsert 

    Does the information in this similar Community Post help

    https://communities.ca.com/message/241816249?commentID=241816249#comment-241816249 



  • 5.  Re: Preventing Closure of Parent Request with Child Incident

    Posted Sep 19, 2018 02:01 PM

    I tried that, it does work to a degree.  I took the macro and installed it.  It is a successful solution, if you are using transitional statuses.   We don't use transitional statuses at all.  I'm more looking for a conditional check at save or at status change or in a partition rule that would solve this issue.



  • 6.  Re: Preventing Closure of Parent Request with Child Incident

    Posted Sep 20, 2018 02:28 AM

    You could use a PRE_VALIDATE trigger to do this. 

    The logic is very similar to Gutis' condition macro in the link above.

    See below.  The trigger fires when either resolve date or close date are set.

    'zcr_triggers.mod':

    OBJECT cr {
        TRIGGERS {
            PRE_VALIDATE  zcrHasNoUnclosedCR(id) 199
                FILTER( resolve_date { -> NOT_NULL } || close_date { -> NOT_NULL } );
        } ;
    } ;

    OBJECT cr {
        FACTORY {
            METHODS {
                zcrHasNoUnclosedCR(int) ;
                } ;
            } ;
        } ;

    'zcrNoUnclosedCR.spl':

    ////////////////////////////////////////////////////////////////////////////
    //
    // Before accepting a resolve_date update, check that the CR has no unresolved CRs as children.
    ////////////////////////////////////////////////////////////////////////////
    #define ZDEBUG 1
    //
    cr::zcrHasNoUnclosedCR(...)
    {
        string    method;
        method    = "cr::zcrHasNoUnclosedCR";
        string    zError;
        // Args: id
        int    in_id;
        in_id = (int)argv[3];
        zError = "";
        if (ZDEBUG > 0) logf(INFO, "%s entered, CR id %d", method, in_id);
        //
        //Get unresolved cr's having this CR's persid as 'parent'.
        //
        string wc1;
        wc1 = "parent like '" + format("cr:%d", in_id) + "' AND (status.active = 1 and status.resolved != 1)";
        logf(INFO, "%s, wc1: %s", method, wc1);
        send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "STATIC", wc1,  -1, 0);
        if (msg_error())
        {
            logf(ERROR, format("%s:ERROR sync_fetch 'cr' '%s'", method, msg[0]));
            set_return_data(FALSE);
        }
        int iCount1;
        object domset1;
        domset1 = msg[0];
        iCount1 = msg[1];
        if (iCount1 == 0) logf(INFO, "%s: domset 'cr' is empty", method);
        logf(INFO, "%s: iCount1=%d", method, iCount1);
        if (iCount1 <= 0 )
        {
            logf(INFO, "%s: cr has NO unclosed CRs, condition is TRUE", method);
            return;
        }
        else
        {
            logf(INFO, "%s: cr has at least one unclosed CR, condition is FALSE", method);
            zError = "Cannot resolve or close a Request/Incident/Problem while a linked Req/Inc/Prb is unresolved";
            set_error(1);
            set_return_data(zError);
            return;
        }
        return;
    }

    Hope that helps.

    Regards,

    James