CA Service Management

  • 1.  Create activity log from action macro crwf

    Posted Nov 03, 2017 06:12 AM

    Hello community, 

     

    I need from action macro cfwf create one activity log in a ticket (cr), for example a comment "this ticket is cancel why the affected contact is not VIP".

     

    is it possible? How?. Example code it is possible.

     

    Regards.



  • 2.  Re: Create activity log from action macro crwf
    Best Answer

    Posted Nov 03, 2017 06:49 AM

    Hi,

    try this one:

    uuid who;
    int msg_i;
    send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");
    if (msg_error()) {
         who = msg[0];
    }
    send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)who, "alg", NULL, 0,
         "call_req_id", cr,
         "time_spent", (duration)0,
         "type", "LOG",     // replace LOG with your own alg type
         "analyst", who,
         "description", format("Cancelled with comment: %s", comments),     // not sure cr_wf comment attribute named "comments" like it in chg.wf
         "action_desc", format("generated by SPEL from cr_wf: %d", id)
    );
    if (msg_error()) for (msg_i = 0; msg_i < msg_length(); msg_i++) logf(ERROR, "%s > msg[%d]: %s", persistent_id, msg_i, msg[msg_i]);

    check incode comments, code is not tested.

     

    Regards,

    cdtj



  • 3.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 07:07 AM

    I get a error to save the macro. I'm testing.....



  • 4.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 07:12 AM

    you can share a error text 



  • 5.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 07:23 AM

    11/03 12:20:07.83 HVSDMCAPre spelsrvr 8080 ERROR pcexec.c 6453 Spell interp failed at Rechaza tarea si tipo acceso NO es Personal Directivo:11:: get_attr on comments failed: AHD03066:Nombre desconocido comments

    11/03 12:20:07.84 HVSDMCAPre spelsrvr 8080 ERROR macro.spl 538 AHD03066:Nombre desconocido
    11/03 12:20:07.86 HVSDMCAPre spelsrvr 8080 ERROR macro.spl 538 comments

    11/03 12:20:07.87 HVSDMCAPre spelsrvr 8080 ERROR bhvtpl.spl 503 bhvtpl::do_behavior() macro 'Rechaza tarea si tipo acceso NO es Personal Directivo' failed: AHD03066:Nombre desconocido



  • 6.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 07:22 AM

    comments is name unknow. i have tested with cr.comments, but don't work. I continue testing....



  • 7.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 08:09 AM

    ah yeah, you can run cmd: bop_sinfo -a cr_wf

    to get actuall attribute name for "comments".



  • 8.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 07:26 AM

    I'm testing this code

     

    send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)"5F07969B61DF5D49991BF91A1FE1B2F7", "alg", NULL, 0, "call_req_id", cr.persistent_id,"time_spent",(duration)0,"type","LOG","analyst", (uuid)"5F07969B61DF5D49991BF91A1FE1B2F7","description", format("Cancelled with comment: %s", comments),"action_desc", format("generated by SPEL from cr_wf: %d", id));



  • 9.  Re: Create activity log from action macro crwf

    Posted Nov 03, 2017 07:38 AM

    I get it:

     

    send_wait(0, top_object(), "call_attr", "api", "insert_object", (uuid)"5F07969B61DF5D49991BF91A1FE1B2F7", "alg", NULL, 0, "call_req_id", cr.persistent_id,"time_spent",(duration)0,"type","LOG","analyst", (uuid)"5F07969B61DF5D49991BF91A1FE1B2F7","description","My comment","action_desc", "My comment");

     

    thank CDTJ for your help

     

    Regards.