CA Service Management

 View Only
  • 1.  Spell code workshift_abs2work not working proper

    Posted Jul 04, 2016 06:55 AM

    We want to calculate holdtime,response time and resolution time according to workshift only.To achive that thing we have used workshift_abs2work function in spell code.But it cause system to hang up state.Without use of that function spell code is working fine.

     

    We have replaced "hold1 = (int)cur_time - (int)zhold_start_date" with  "hold1 = workshift_abs2work("Mon - Sat { 10:10 am - 2:30 pm }",zhold_start_date,cur_time);" in our changes.

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    Hold time calculation spell code.

    Spell code before adding a function.

    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;

     

      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;

     

      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;

     

     

      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 = 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;

     

      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; 

    }

     

    }

    -----------------------------------------------------------------------------------------------------------------------------------------------------------

    Spell code after adding a function.

    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 - 2:30 pm }",zhold_start_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 - 2:30 pm }",zhold_start_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 - 2:30 pm }",zhold_start_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 = 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 - 2:30 pm }",zhold_start_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: Spell code workshift_abs2work not working proper
    Best Answer

    Posted Jul 04, 2016 08:21 AM

    Hi,

    as I remember workshift_abs2work function input params should be in followed order : string, date, date.

    First input (workshift) seems to be correct, but other inputs are in unix timestamp and passes as int, try to pass them as date:

    workshift_abs2work("Mon - Sat { 10:10 am - 2:30 pm }", (date)zhold_start_date, (date)cur_time);

    or

    date zhold_start_date, cur_time;

    <... some assignments here ...>

    workshift_abs2work("Mon - Sat { 10:10 am - 2:30 pm }", zhold_start_date, cur_time);

    Regards,

    cdtj



  • 3.  Re: Spell code workshift_abs2work not working proper

     
    Posted Jul 11, 2016 05:36 PM

    Hi sanketkumar.d - Did cdtj's response help answer your question? If so please mark as Correct Answer. Thanks!