CA Service Management

  • 1.  Detach An Event?

    Posted Apr 27, 2017 07:16 PM

    Hello,

     

    When a ticket is updated to our custom status 5-Hold Awaiting Cust. Response I've attached an event that will fire after 30 work hours and check if it is still in this status, and if so it becomes close requested.

     

    Is there a way to detach an event? If a ticket is changed from the status 5-Hold Awaiting Cust. Response I want the event to die, because if its changed back to 5-Hold Awaiting Cust. Response within that 30 hours I want the timer to start again.

     

    https://communities.ca.com/thread/241774729

     

    Thanks Stuart



  • 2.  Re: Detach An Event?

    Posted Apr 28, 2017 01:05 AM

    Hi,

    sure, you need to call cancel_me method.

    Detailed example could be found here: https://communities.ca.com/thread/241735782#comment-241843863 

     

    Talking about whole code, it could be:

    mod file:

    // please provide correct status code here
    MODIFY cr status ON_POST_VAL z_cancel_hacr() 9337701 FILTER(status('HACR' -> ));

    spl file:

    int zcount, i, msg_i;
    object zfound, zobj;
    // provide correct event template persid here
    send_wait(0, top_object(), "call_attr", "atev", "sync_fetch", "STATIC", format("event_tmpl = 'evt:123456' AND status_flag IN (2, 12) AND obj_id = '%s'", persistent_id), -1, 0);
    if (msg_error()) {
        logf(ERROR, "%s > Unable to fetch atev", persistent_id);
        for (msg_i = 0; msg_i < msg_length(); msg_i++) {
            logf(ERROR, "msg[%d]: %s", msg_i, msg[msg_i]);
        }
    } else {
        zcount = msg[1];
        if (zcount > 0) {
            zfound = msg[0];
            for (i = 0; i < zcount; i++) {
                send_wait(0, zfound, "dob_by_index", "DEFAULT", i, i);
                if (msg_error()) {
                    logf(ERROR, "%s > Unable to get dob_by_index", persistent_id);
                    for (msg_i = 0; msg_i < msg_length(); msg_i++) {
                        logf(ERROR, "msg[%d]: %s", msg_i, msg[msg_i]);
                    }
                } else {
                    zobj = msg[0];
                    atev::z_cnclme_by_persid(zobj.persistent_id);
                }
            }
        }
    }

     

    Regards,

    cdtj