CA Service Management

  • 1.  Activity macro can access to caller Event information?

    Posted Jan 06, 2017 08:56 AM

    Hi,

     

    I cretaed an activity macro (cr_wf) which attached to a CR_WF Event.

    This macro collect cr_wf attributes and create activity log. It is working well.

     

    But me missing that information which Event call this action macro.

    I want to put this important information into log.

     

    When the action macro is runing than access the cr_wf attributes but cannot access to the Event attributes.

    I can retrieve all events which are connected to the cr_wf but I cannot decide which called the action macro.

     

    Is there any idea?

     

    Regards, Gábor



  • 2.  Re: Activity macro can access to caller Event information?
    Best Answer

    Posted Jan 06, 2017 05:15 PM

    Hi,

    looking to OOTB status change macro, you can access event using attached_event variable.

    also you can get:

    group_leader - group leader;

    event_tmpl - event template;

     

    Regards,

    cdtj



  • 3.  Re: Activity macro can access to caller Event information?

    Posted Jan 09, 2017 04:12 AM

    Hello CDTJ,

     

    Thank you the answer.

    This information helped me. I can logging the name of the Event template into the activity log.

     

    But, remaining one other issue.

    So, I used the spell API in the cr_wf activity macro and the activity log created.

    But when I create new cr activity macro  (same API) to logging which Events briched than the stdlog say: "checked out by someone else". And the log writing missing.

    Is there any difference between cr and cr_wf?

    Or have to use the old spell way to check out objec, modify and check in back?

     

    Regards, Gábor



  • 4.  Re: Activity macro can access to caller Event information?

    Posted Jan 09, 2017 04:20 AM

    Could you share your code?



  • 5.  Re: Activity macro can access to caller Event information?

    Posted Jan 09, 2017 04:45 AM

    This is the Activity macro style a test script, with some unnecessary log.

     

    "// CR Event 1 unsuccesful\\0012\\0012
    uuid who;\\0012
    logf(SIGNIFICANT, \"persistent_id: %s\", persistent_id);\\0012
    send_wait(0,top_object(), \"call_attr\", \"cnt\", \"current_user_id\");\\0012
    who=msg[0];\\0012
    if (msg_error()){\\0012
    logf(SIGNIFICANT,\"WHO CR - Error '%s'\",msg[0]);\\0012
    }\\0012
    string description, persid;\\0012
    persid=persistent_id;\\0012
    description = \"CR Event 1 unsuccesful.\";
    logf(SIGNIFICANT, description);\\0012
    send_wait(0, top_object(), \"call_attr\", \"api\", \"generic_activity_log\", who, persid, description, \"EVT_CR_FAI\", 0, 0);\\0012
    if (msg_error()) {\\0012
    logf(ERROR,\"Error %s\",msg[0]);\\0012
    }\\0012
    \\0012"

     

    Regadrs, Gábor



  • 6.  Re: Activity macro can access to caller Event information?

    Posted Jan 09, 2017 05:26 AM

    generic_activity_log can cause checkout/checkin procedure like it did when you log comment, change status, etc.

    And seems like this method can't handle existing group_leader so you can't perform double checkout (from event/macro and generic log) at the same time.

     

    Try to simply insert activity log using insert_object or get_new_dob method, example:

    // this line will replace generic_activity_log
    send_wait(0, top_object(), "call_attr", "api", "insert_object", who, "alg", NULL, 0,
                        "type", "EVT_CR_FAI",
                        "time_spent", (duration)0,
                        "call_req_id", persid,
                        "description", format("CR Event 1 unsuccesful. Event template [%s]", (string)event_tmpl)
              );

     

    Also you can try to pass event's group_leader as parameter to this method (replace NULL with group_leader, which specified after "alg").

     

    Regards,

    cdtj



  • 7.  Re: Activity macro can access to caller Event information?

    Posted Jan 09, 2017 05:48 AM

    Hi,

     

    It is helped me.

    Good idea to use other merhod to create log.

     

    Regards, Gábor



  • 8.  Re: Activity macro can access to caller Event information?

    Posted Jan 09, 2017 05:53 AM

    Thanks your help CDTJ!

     

    Gábor