CA Service Management

 View Only
Expand all | Collapse all

Propagate "Log Comment" to children

  • 1.  Propagate "Log Comment" to children

    Posted Apr 07, 2016 03:04 PM
      |   view attached

    We currently are using a feature that allows us to propagate a status change to any associated children. Has anyone ever done a similar thing with the "Log Comment"?

     

    Attached is the documentation we have used for the status change.

    Attachment(s)



  • 2.  Re: Propagate "Log Comment" to children

    Posted Apr 07, 2016 05:00 PM

    Yes you can do this, but it will be spel code customization. So if You ok with this I or other guys from community may help you



  • 3.  Re: Propagate "Log Comment" to children

    Posted Apr 08, 2016 03:00 AM

    How about trying to use the 'Related Ticket Activity' on the 'Log Comment' activity notification?

    Related Ticket Activity - Specifies if the activity log on a ticket is propagated to all related tickets. The activity log propagation is only valid for related incidents, problems, and change orders.

     

    If this does not work, it would be a good Enhancement Request (Idea) for this functionality to be extended to child tickets.

     

    Kind Regards,

    Brian



  • 4.  Re: Propagate "Log Comment" to children

    Posted Apr 08, 2016 05:10 AM

    good idea Brian_Mathato

    didn't never thing about this to propagate activities.

    the only downside I see if this work as expected here is that this is for all cr/iss/chg for that activity and you can't segregate only for a specific ticket type.

    /J



  • 5.  Re: Propagate "Log Comment" to children

    Posted Apr 08, 2016 04:06 PM

    Any directions on how to go about that? We haven't done much in the notifications outside of just sending email notifications.

     

    Thanks,

    Alex



  • 6.  Re: Propagate "Log Comment" to children
    Best Answer

    Posted Apr 15, 2016 08:32 AM

    Hi,

     

    I got this action through spel code. I used the same principle to propagate the status. The following steps were used:

     

    1º - I created a new attribute (screen painter - designer): zset_child_f

    2º - I put the following trigger on the table alg: POST_VALIDATE zsoln_to_child() 111 FILTER(type{-> 'LOG'} && zset_child_f == 1);

    3º - I created the following file, z_logschild.mod with the following content:

    OBJECT alg {

      ATTRIBUTES Act_Log {

        zset_child_f LOCAL INTEGER { ON_DB_INIT SET 0 ; } ;

      };

    };

    4º I created the following file, z_logschild.spl with the following content:

    alg::zsoln_to_child(...) {

      string c_desc, c_num, c_persid, c_type, p_num, p_type, wc;

      object c_dob, c_list, group_leader, act_log_table_record;

      int c_count, i;

     

      p_num = call_req_id.ref_num;

      p_type = call_req_id.type.sym;

      wc = format("parent = '%s'", call_req_id);

     

      send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "MLIST_STATIC", wc, -1,0);

      c_count = msg[1];

      c_list = msg[0];

      if (c_count > 0) {

      for(i=0;i< c_count;i++) {

      send_wait(0, top_object(), "get_co_group");

      group_leader = msg[0];

     

      send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i);

      c_dob = msg[0];

     

      send_wait(0, c_dob, "get_attr_vals",3,"ref_num","type.sym", "persistent_id");

      c_num = msg[3];

      c_type = msg[6];

      c_persid = msg[9];

      c_desc = description + " (Iniciado a partir do " + p_type + " pai " + p_num + ")" ;

     

      send_wait(0, top_object(), "call_attr", "alg", "get_new_dob", NULL, NULL, group_leader);

      act_log_table_record = msg[0];

      act_log_table_record.action_desc = action_desc;

      act_log_table_record.call_req_id = c_persid;

      act_log_table_record.description = c_desc;

      act_log_table_record.internal = internal;

      act_log_table_record.time_spent = 0;

      act_log_table_record.type = type;

      send_wait(0, group_leader, "checkin");

      if (msg_error()) {

      logf(ERROR, "error adding log on Child %s %s from Parent %s %s - %s", c_type, c_num, p_type, p_num, msg[0]);

      } else {

      logf(SIGNIFICANT, "successfully added log on Child %s %s from Parent %s %s", c_type, c_num, p_type, p_num);

      send_wait(0, group_leader, "checkout", c_dob);

      last_mod_dt = (int)now();

      //send_wait(0, group_leader, "checkin"); conflito com o código validate_parent.spl

      if (msg_error()) {

      logf(ERROR, "error updating last_mod_dt on %s %s - %s", c_type, c_num, msg[0]);

      } else {

      logf(SIGNIFICANT, "successfully updated last_mod_dt on %s %s", c_type, c_num);

      }

      }

      }

      }

    }

    5° I included the new attribute in the form detail_alg.htmpl

    <!-- Inclusão de linha para propagar registro de comentários para ticket filho Leônio 23/09/2015 -->

     

    <PDM_IF "$args.ACTIVITY_LOG_TYPE" == "LOG" && $args.children.length != 0 >

    <PDM_MACRO name=dtlCheckbox hdr="Adicionar no log do ticket filho?" attr=alg.zset_child_f>

    </PDM_IF>

     

    Any doubt I am available.



  • 7.  Re: Propagate "Log Comment" to children

    Posted Apr 28, 2016 08:30 AM

    Thanks so much for your response to this. I just started tackling it late yesterday. I was able to apply everything successfully, I think. When, I log a comment to the parent it does not update the child. The parent still updates though. I took screenshots of everything I did. Can you verify that I didn't miss any of your steps?

    Thanks,

    Alex

     

     

    ALG_SchemaDesigner.jpg

     

    This is the location for the mod and spl files

    MajicDirectory.jpg

     

     

    z_logschild_mod_Code.jpg

     

    z_logschild_spl_Code.jpg

     

    This is the detail_alg.htmpl

    detail_algAttribute.jpg



  • 8.  Re: Propagate "Log Comment" to children

    Posted Apr 28, 2016 02:00 PM

    Sorry, I forgot to mention the procedure. In my case it is not required to spread information. The analyst has to select the "Add to child ticket log." The following print screen step by step process.

    Sem título1.png

    Sem título2.png

    Sem título3.png

    Sem título4.png



  • 9.  Re: Propagate "Log Comment" to children

    Posted Apr 29, 2016 10:28 AM

    Yes. I am follow these exact same steps that you're following, but the child does not update. The parent does, but the child does not.



  • 10.  Re: Propagate "Log Comment" to children

    Posted Apr 29, 2016 11:12 AM

    I checked what you've done and all is right.I'm not sure, but try changing this parameter as shown in the figure below.Sem título.png



  • 11.  Re: Propagate "Log Comment" to children

    Posted May 03, 2016 10:48 AM

    Still no luck. Very weird that it works for you but not for me.



  • 12.  Re: Propagate "Log Comment" to children

    Posted May 03, 2016 03:39 PM

    Use type=='LOG' in your trigger



  • 13.  Re: Propagate "Log Comment" to children

    Posted May 03, 2016 03:46 PM

    By the way did you recycled SDM services after adding mod and spl files?



  • 14.  Re: Propagate "Log Comment" to children

    Posted May 27, 2016 01:37 PM

    Sorry I have been away for awhile.

    type=='LOG' did not work.

     

    SDM service has been cycled several times throughout this process.



  • 15.  Re: Propagate "Log Comment" to children

    Posted May 27, 2016 02:27 PM

    Alexander,

     

    I do not know what might be going wrong in its implementation. You can inform your e-mail, so I can send the files I'm using here?



  • 16.  Re: Propagate "Log Comment" to children

    Posted May 31, 2016 10:58 AM


  • 17.  Re: Propagate "Log Comment" to children

    Posted May 27, 2016 02:56 PM

    Just to confirm the full trigger, I am using is this:

    POST_VALIDATE zsoln_to_child() 112 FILTER(type== 'LOG' && zset_lc_child_f == 1);

     

    Is that correct?



  • 18.  Re: Propagate "Log Comment" to children

    Posted May 27, 2016 03:05 PM

    I configured this way:

     

    ////////////////////////////////////////////////////////////////////////

    // Fábrica:   alg

    ////////////////////////////////////////////////////////////////////////

     

     

    OBJECT alg {

      TRIGGERS {

        POST_VALIDATE zlog_to_child() 111 FILTER(type{-> 'LOG'} && zset_child_f == 1 );

           };

    };

     

     

    MODIFY alg zset_child_f

    {

        ON_NEW DEFAULT 1;

    };

     

    The difference is in this condition:

    you used --> type== 'LOG'

    I used --> type{-> 'LOG'}



  • 19.  Re: Propagate "Log Comment" to children

    Posted Jun 09, 2016 04:06 PM

    Finally got this. For some reason I missed on the detail_alg that I needed to have "alg." preceding my variable in the attribute. Thank you for everyone's assistance on this. Definitely made it easier.

     

    Alex



  • 20.  Re: Propagate "Log Comment" to children

    Posted Jan 05, 2017 02:08 PM

    So I recently found that when a comment is propagated to the child, the modified date is not updated on the child. Any thoughts on what might be the cause of this? It looks like this is accounted for in the spel code, but I am definitely not an expert with spel code.



  • 21.  Re: Propagate "Log Comment" to children

    Posted Jan 06, 2017 05:24 AM

    Hi,

    I have partially modified your code, try this one:

    alg::zsoln_to_child(...) {
        string c_desc, c_num, c_persid, c_type, p_num, p_type, wc;
        object c_dob, c_list, group_leader, act_log_table_record;
        int c_count, i;

        p_num = call_req_id.ref_num;
        p_type = call_req_id.type.sym;
        wc = format("parent = '%s'", call_req_id);

        send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "MLIST_STATIC", wc, -1, 0);
        c_count = msg[1];
        c_list = msg[0];
        if (c_count > 0) {
            for (i = 0; i < c_count; i++) {
                send_wait(0, top_object(), "get_co_group");
                group_leader = msg[0];

                send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i);
                c_dob = msg[0];

                send_wait(0, c_dob, "get_attr_vals", 3, "ref_num", "type.sym", "persistent_id");
                c_num = msg[3];
                c_type = msg[6];
                c_persid = msg[9];
                c_desc = description + " (Iniciado a partir do " + p_type + " pai " + p_num + ")";

                send_wait(0, top_object(), "call_attr", "alg", "get_new_dob", NULL, NULL, group_leader);
                act_log_table_record = msg[0];
                act_log_table_record.action_desc = action_desc;
                act_log_table_record.call_req_id = c_persid;
                act_log_table_record.description = c_desc;
                act_log_table_record.internal = internal;
                act_log_table_record.time_spent = 0;
                act_log_table_record.type = type;
                   send_wait(0, group_leader, "checkout", c_dob);
                   // send_wait(0, c_dob, "call_attr", "last_mod_dt", "set_val", now(), "SURE_SET");
                   send_wait(0, group_leader, "checkin");
                   if (msg_error()) {
                        logf(ERROR, "error updating last_mod_dt on %s %s - %s", c_type, c_num, msg[0]);
                   } else {
                        logf(SIGNIFICANT, "successfully added log on Child %s %s from Parent %s %s", c_type, c_num, p_type, p_num);
                   }
            }
        }
    }

     

    If after modifications last mod date still willn't be changed, uncomment (remove //) line 36 and try again.

     

    Regards,

    cdtj



  • 22.  Re: Propagate "Log Comment" to children

    Posted Jan 06, 2017 11:59 AM

    This worked perfectly. Thanks.



  • 23.  Re: Propagate "Log Comment" to children

    Posted Jan 06, 2017 12:01 PM

    Also. I did not have to remove the comment on line 35



  • 24.  Re: Propagate "Log Comment" to children

    Posted Jan 09, 2017 06:54 AM

    Hi Dion, sorry I did not answer before, I was on vacation. Still have questions that I can help?