CA Service Management

Expand all | Collapse all

Capture last register comment

Joaquin Adrian Chumillas del Pino

Joaquin Adrian Chumillas del PinoNov 05, 2018 02:40 AM

  • 1.  Capture last register comment

    Posted Oct 01, 2018 05:14 AM

    Hello, 

     

    I am working in R17.1 and I have a question. is It possible to capture the last comment act_log, type LOG with a action macro of a request (macro status workflow task), and save this last comment in a request field, for example description?.

     

    Regards.



  • 2.  Re: Capture last register comment

    Posted Oct 01, 2018 02:39 PM

    Have you considered doing it with some Javascript in the detail_alg.htmpl file?



  • 3.  Re: Capture last register comment

    Posted Oct 02, 2018 04:08 AM

    Hello, 

     

    I will prefer to do with a action macro. I don't controller the javascript, and I don't know how do it.

     

    Regards.



  • 4.  Re: Capture last register comment

    Broadcom Employee
    Posted Oct 02, 2018 11:35 AM

    If I haven't misunderstood, this knowledge article may help: KB000054154



  • 5.  Re: Capture last register comment

    Posted Oct 02, 2018 12:04 PM

    Hi Karen, 

     

    Yes, more or less, I need this, but Can I use the @{call_req_id.act_log_all.0.description} variable in a action macro?

     

    I think thaat this variable is for use in notification templates. I will test it in action macro.

     

    Regards.

     



  • 6.  Re: Capture last register comment

    Posted Nov 05, 2018 02:40 AM

    Any more ideas?



  • 7.  Re: Capture last register comment

    Posted Nov 05, 2018 08:11 PM

    Do you simply want to display the last log comment in the detail_form or do you want access to it for other notifications, etc?



  • 8.  Re: Capture last register comment

    Posted Nov 06, 2018 02:05 AM

    Hello, 

     

    I simply want to create a action macro that this macro capture the last log comment in a variable, and the macro save the variable content in a field (for example zlastlog field). This field will be to show in a form, for example detail_in.htmpl.

     

    do you understand me?

     

    Thanks, 

     

    Regards.



  • 9.  Re: Capture last register comment

    Broadcom Employee
    Posted Nov 07, 2018 03:21 PM

    you could do it like this...

    add a spel trigger for alg object for insert operation that the "description" of the activity log is assigned to zlastlog.

    then you action macro can simply set the incident description as zlastlog



  • 10.  Re: Capture last register comment

    Posted Nov 08, 2018 03:01 AM

    Hello

     

    Could you give me the source code for trigger and action macro, please?

     

    Regards.



  • 11.  Re: Capture last register comment
    Best Answer

    Posted Nov 08, 2018 10:27 AM

    Sure, here you go.

     

    Steps:

    1. Add zAlgComment to cr schema and publish changes (should be a string with length 4000)

    2. Create a zAlg.mod and zAlg.spl file and place in nx_root/site/mods/magic directory of all sdm servers

    3. Restart sdm services

     

    zAlg.mod file

    MODIFY alg  POST_CI zCRComment(call_req_id,description) 10000 FILTER(type == "LOG" && EVENT("INSERT UPDATE"));

     

    zAlg.spl file

    alg::zCRComment(...)
    {
      string method,persid,description;
      uuid  who;
      method ="alg::zCRComment";
      logf(MILESTONE, "%s started", method);

      persid = argv[3];
      description = argv[6];

      send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
      who=msg[0];
     
      send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persid, 0, "zAlgComment", description);

      logf(MILESTONE, "%s ended", method);
    }


  • 12.  Re: Capture last register comment

    Posted Nov 09, 2018 02:37 AM

    Hello, 

     

    Thanks for the code. Today, I will test and I will report the results.

     

    Regards.



  • 13.  Re: Capture last register comment

    Posted Nov 09, 2018 05:39 AM

    Thanks friend, 

     

    Great!!!!!. Works nice.

     

    Best Regads.



  • 14.  Re: Capture last register comment

    Posted Nov 09, 2018 10:38 AM

    You’re welcome!



  • 15.  Re: Capture last register comment

    Posted Dec 21, 2018 05:07 AM

    Hi Grant one question more

     

    if is it possible to indicate in the spel code only the last comment checked how internal?

     

    Regards.