AnsweredAssumed Answered

Spell code workshift_abs2work not working proper

Question asked by sanketkumar.d on Jul 4, 2016
Latest reply on Jul 11, 2016 by Chris_Hackett

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; 

}

 

 

}

Outcomes