CA Service Management

Expand all | Collapse all

Update category with Spl Code

  • 1.  Update category with Spl Code

    Posted 05-11-2021 01:31 PM

    I need change category depend of two fields, the code SPL is:

    mods
    MODIFY cr POST_VALIDATE zcheck_category(category) 10070 FILTER (EVENT("UPDATE"));


    SPL

    cr::zcheck_category(...){
    string Method, errmsg, notificacion, relevante;
    Method="zcheck_category";

    uuid who;
    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
    who=msg[0];

    send_wait( 0, this, "get_attr_vals", 2, "ztiponotif", "zmttorelev");
    notificacion=msg[3];
    relevante=msg[6];

    if(notificacion=="Mantenimiento" && relevante=="Si"){
    send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, "cr:401252", 0, "category", "pcat:5103");
    if (!msg_error()) {
    send_wait(0, group_leader, "checkin");
    if (msg_error()) {
    printf("Error'%s'", msg[0]);
    }
    }
    else{
    printf("create failed %s",msg[0]);
    }
    }

    }

    the error I have with this code is

    ERROR top_ob.c 4204 Internal error in uncheck_partial for mRIAAA - status 6 is not IDLE
    ERROR top_ob.c 3258 Internal error starting checkout for mRIAAA - status 6 is not IDLE or PRE_CI_WAIT



  • 2.  RE: Update category with Spl Code

    Posted 05-12-2021 02:02 AM
    Hi Christian.
    There are several problematic parts in your code.
    The error message tells you that your code tries to checkout additional records, while the current group-leader is in a checkin phase.
    This usually happens, when your code is trying  to checkout records in a POST_VALIDATE trigger .
    This is just not possible.
    I think , that using these api methods in a trigger context isn't a good idea. I assume, they are not intended to be used in a trigger context.
    Instead, you could directly change the value of the category of the current ticket just by
    category="pcat:1503";
    But be aware, that the referenced category might have required properties, so the checkin will fail as well ;)
    And don't manually checkin something in a trigger unless you know, what you're doing ;)
    Regards
    ........Michael

    ------------------------------
    Principal Services Consultant
    HCL Enterprise Studio
    Germany
    ------------------------------