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.