Clarity Service Management

Expand all | Collapse all

Site Defined Condition End User's Special Handling for Notification

Jump to Best Answer
  • 1.  Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 09:12 AM

    Hey guys!


    I'm trying to create a condition for notifying groups based on special handling.

     

    Searching the community I was able to find this topic (Is it possible to set up a Notification based on the Affected End User's special handling status? ) that was very relevant.

     

    I created a condition macro and made the modifications in detail_macro.htmpl to allow editing the macro code to insert the code referenced in the topic:

     

    object list_handlings;
    int i,found;


    send_wait(0,top_object(),"call_attr","contact_handling","sync_fetch","STATIC", "contact = ?",-1,1, this.customer);
    list_handlings = msg[0];

    for(i=0;i<list_handlings.length;i++)
    {
    if(list_handlings[i].special_handling.sym == "VIP")
    { found=1;}
    }

    if(found==1)
    return true;
    else
    return false;

     

    However, when I try to save this new macro I get an error message "Error validating macro:":

     

     

    Could you tell me if I'm doing something wrong in creating this macro?

     

    Many thanks!



  • 2.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 10:03 AM

    Hi Diego,

     

    You can create a condition or an action macro use by pdm_extract and pdm_load methods. How?

     

    Firstly extract a condition macro by use pdm_extract method then modify the which you extracted file then you can load this file by use pdm_load method with insert parameter (-i)

     

    I hope, I can help you

     

    Regards,

    Türker



  • 3.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 10:20 AM

    Hi birolturker.kara!

     

    I already tried to do something like this, however the code suggested in the referenced topic is not accepted in userload.

     

     



  • 4.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 10:46 AM

    what is in the stdlog?



  • 5.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 11:02 AM

    Hi, Chi_Chen!!

     

    There is not much relevant information on errors presented in stdlog, as bellow:

     

    10/18 11:58:20.63 SDF0376        spelsrvr             5044 ERROR        macro.spl              124 Error validating macro: 'object list_handlings; int i,found; send_wait(0,top_object(),"call_attr","contact_handling","sync_fetch","STATIC", "contact = ?",-1,1, this.customer); list_handlings = msg[0]; for(i=0;i<list_handlings.length;i++) { if(list_handlings[i].special_handling.sym == "the special handling you want") { found=1;} } if(found==1){ set_return_data(TRUE); } else{ set_return_data(FALSE); }'

     

    Many thanks for your response!



  • 6.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 11:22 AM

    The format seems is not right. Mainly, you missed \\0012  as return new line. For example, it should be 

    object list_handlings;\\0012 int i,found;\\0012...
    not
    object list_handlings; int i,found;


  • 7.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 02:13 PM

    Hi Chi_Chen!

     

    Thanks for your response!

     

    Placing the value \\0012 between the code and making a load attempt using the userload option displays a message stating "Invalid row termination, expected}".

     

    I imagine that due to problems in the quotation marks available in the code the values are not loadead as correctly.

     

    It is suggested in the topic the edition of detail_macro.htmpl form to enable and add the code that will do this, but for some reason it is not accepting the information that I enter.



  • 8.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-18-2018 02:27 PM

    you would need to escape " with \...for example, 

    "call_attr"
    should be
    \"call_attr\"


  • 9.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-24-2018 09:36 AM

    Hi Chi_Chen!

     

    Many thanks for the information.

     

    After organizing the values i was able to load the code correctly.


    However, the macro is not correctly conditioning the triggering of a multiple notification.

     

    Could they tell you if there's something wrong with the code?

     



  • 10.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-24-2018 09:40 AM

    I already tried to change the value of the line:

    if(list_handlings[i].special_handling.sym == "VIP")

    To:

    if(list_handlings[i].special_handling == "1001")
    if(list_handlings[i].special_handling == '1001')
    if(list_handlings[i].special_handling == 1001)

     

    But it still didn´t work.



  • 11.  Re: Site Defined Condition End User's Special Handling for Notification
    Best Answer

    Posted 10-26-2018 06:17 AM

    Hi

    I think you misunderstood the result of your sync_fetch.

    list_handlings is not an array of objects, but only a variable of type object, which reflects a result set.

    But the single object in that result set/domset is not accissible by [i].

    maybe the following will work:

     

    object list_handlings;
    int i,found;

    object cnt_handling;
    int list_count;

    send_wait(0,top_object(),"call_attr","contact_handling","sync_fetch","STATIC", "contact = ?",-1,1, this.customer);
    list_handlings = msg[0];
    list_count= msg[1];

    for(i=0;i<list_count;i++){
       send_wait(0,list_handlings,"dob_by_index", "DEFAULT", i, i);
       cnt_handling=msg[0];
       if(cnt_handling.special_handling.sym == "VIP"){
          found=1;
          break;
       }
    }

    if(found==1)return true;
    else return false;

     

    In fact from a performance point of view, you might not need to iterate through a result set at all, but let the db do the work.

    object list_handlings;
    int i,found;

    send_wait(0,top_object(),"call_attr","contact_handling","sync_fetch","STATIC", "contact = ? and special_handling.sym='VIP'" ,-1,1, this.customer);
    found = msg[1];

    if(found > 0)return true;
    else return false;

     

    Hope that helps. Regards

     

    ..........Michael



  • 12.  Re: Site Defined Condition End User's Special Handling for Notification

    Posted 10-26-2018 09:00 AM

    Hi Michael_Mueller!

     

    Many thanks for the great help!

     

    I made some small changes to your suggestion and the condition was executed correctly, as bellow:

     

    object list_handlings;
    int i, found;
    send_wait(0, top_object(), "call_attr", "contact_handling", "sync_fetch", "STATIC", "contact = ? and special_handling.sym='VIP'", -1, 1, this.customer);
    found = msg[1];
    if (found > 0) {
    set_return_data(TRUE);
    } else {
    set_return_data(FALSE);
    }

     

    Thank you so much for the help!