CA Service Management

  • 1.  Hold calculation for awaiting vendor not working

    Posted Aug 29, 2016 04:49 AM

    We have implemented a spell code for calculating the hold time for a request . It is working fine for the status-awaiting end user and hold . But same isnt working for the status - awaiting vendor . The spell code is given below . Kindly help. 

    We have done some required changes foe awaiting vendor as given below in code2.

     

    Code1(Before changes)

    cr::zstatus_hold1(...)
    {

    int cur_time;
    cur_time = now();
    int hold1;
    int total_time;


    if (zuser.type.id == 2305)
    {

    // if the emoloyee finds the call in the Awaiting End User Response category, and finally provides an input.
    if((status == "AEUR") && (!(is_null(zhold_start_date))))
    {

    send_wait( 0, this, "call_attr", "status", "set_val", "AEURU", "SURE_SET");
    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    return;
    }

     

    }
    else
    {
    if((status == "WIP") && (!(is_null(zhold_start_date))))
    {

    // hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    return;
    }

     

    }

     

    //If the employee or analyst closes the call
    if ((status == "CL"))
    {
    //if the call was on hold when the employee closes the call
    if (!(is_null(zhold_start_date)))
    {
    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    }

    //total_time = (int)close_date - (int)open_date;
    total_time = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)open_date,(date)close_date);


    total_time = total_time - (int)zhold_time;
    send_wait( 0, this, "call_attr", "ztotal_call_time", "set_val", total_time, "SURE_SET");
    return;

    }

     

    //if the employee finds the call as Resolved but wants to restart the work flow
    if(zis_held == 1)
    {
    send_wait( 0, this, "call_attr", "status", "set_val", "WIP", "SURE_SET");
    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    send_wait( 0, this, "call_attr", "zis_held", "set_val", 0, "SURE_SET");
    return;
    }


    }

     Code2(After changes as shown below in bold)

    cr::zstatus_hold1(...)
    {

    int cur_time;
    cur_time = now();
    int hold1;
    int total_time;


    if (zuser.type.id == 2305)
    {

    // if the emoloyee finds the call in the Awaiting End User Response category, and finally provides an input.
    if((status == "AEUR") && (!(is_null(zhold_start_date))))
    {

    send_wait( 0, this, "call_attr", "status", "set_val", "AEURU", "SURE_SET");
    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    return;
    }

     

    }
    else
    {
    if((status == "WIP") && (!(is_null(zhold_start_date))))
    {

    // hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    return;
    }

     

    }


    if((status == "AWTVNDR") && (!(is_null(zhold_start_date))))
    {

    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    return;
    }

     


    //If the employee or analyst closes the call
    if ((status == "CL"))
    {
    //if the call was on hold when the employee closes the call
    if (!(is_null(zhold_start_date)))
    {
    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    }

    //total_time = (int)close_date - (int)open_date;
    total_time = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)open_date,(date)close_date);


    total_time = total_time - (int)zhold_time;
    send_wait( 0, this, "call_attr", "ztotal_call_time", "set_val", total_time, "SURE_SET");
    return;

    }

     

    //if the employee finds the call as Resolved but wants to restart the work flow
    if(zis_held == 1)
    {
    send_wait( 0, this, "call_attr", "status", "set_val", "WIP", "SURE_SET");
    //hold1 = (int)cur_time - (int)zhold_start_date;
    hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 5:00 pm }",(date)zhold_start_date,(date)cur_time);
    if(is_null(zhold_time))
    {
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    else
    {
    hold1 = (int)zhold_time + hold1;
    send_wait( 0, this, "call_attr", "zhold_time", "set_val", hold1, "SURE_SET");
    }
    send_wait( 0, this, "call_attr", "zhold_start_date", "set_val", NULL, "SURE_SET");
    send_wait( 0, this, "call_attr", "zis_held", "set_val", 0, "SURE_SET");
    return;
    }


    }



  • 2.  Re: Hold calculation for awaiting vendor not working

    Posted Aug 30, 2016 02:58 AM

    Hi,

    can you share the trigger  that call this code too?

    Also do you have any requirement to exclude some hold status from this code otherwise this can be dramatically simplified by using  if((status.hold == 1) && (!(is_null(zhold_start_date))) as you seems to repeating the same for each status (then you replace all your if statement by a single one).

    my 2 cents

    /J



  • 3.  Re: Hold calculation for awaiting vendor not working

    Posted Aug 31, 2016 02:13 AM

    Hi,

    Currently on cr object we have the given trigger :

    POST_CI val_fieldupdate_site(persistent_id, audit_userid, CHANGED_ONLY, zhold_time, zresponse_time, zresolution_time, zdesc_update_hidden,zdesc_update) 1001 FILTER(EVENT("UPDATE"));
    PRE_VALIDATE zsolution_req() 1002;
    PRE_VALIDATE zreopen_cr() 1003;
    POST_VALIDATE zstatus_hold1() 1004;
    POST_VALIDATE zdesc_unchanged() 1005 FILTER(EVENT("UPDATE"));
    POST_VALIDATE zacktime() 1006;
    PRE_VALIDATE zuser_validate() 1009 FILTER(EVENT("INSERT UPDATE"));
    PRE_VALIDATE zenduser_validate() 1010 FILTER(EVENT("INSERT UPDATE"));
    POST_VALIDATE zresponse_time() 1011;
    POST_VALIDATE zresolution_time() 1012;