Hey guys,
First of all, i apologize for not being so familiar with SPEL codes, this is one of my first attempts to perform a customization using these triggers.
Well, in this time, i need to find a way to change the status of all child tickets based on a predefined condition.
For this, after some researches, i was able to structure this code that, in my little understanding, would be able to change the status of all children tickets.
cr::zaprove_child(...){
uuid who;
string wc;
int c_count, i;
object c_dob, c_list;
wc = format("parent = 'cr:%s' AND active = 1");
send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "MLIST_STATIC", wc, -1, 0);
c_list = msg[0];
c_count = msg[1];
if (c_count > 0) {
for(i=0; i<c_count; i++) {
send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i);
c_dob = msg[0];
who=msg[0];
send_wait(0, top_object(), "call_attr", "api", "generic_status_change", who, c_list, "Status alterado via SPEL Code", "crs:40001");
}
if (msg_error()) {
logf(ERROR, "Error changing child status", msg[0]);
} else {
logf(SIGNIFICANT, "Successfully changing child status");
}
}
}
To test the customization I triggered the file as follows:
TRIGGERS {
POST_VALIDATE zaprove_child(child) 18 FILTER (EVENT("UPDATE") && (parent != NULL));
};
My client requested that this action be executed when clicking on a button in the parent ticket, i also imagined that, when I finish the entire structure of my SPEL code, cause the action to be triggered by clicking a button, simliar to the closse_all_child function ina button:
ImgBtnCreate("btn001", "Fechar todos os filhos", "pdm_submit('main_form','CLOSE_ALL_CHILD')", true, 120);
In the stdlog file the following error message is displayed when I create a ticket and associate it with a parent
spelsrvr 18100 ERROR pdm_misc.pm 106 Error doing auto_find_assignee AHD05451:cr:513951 Nenhum Grupo qualificado encontrado
spelsrvr 18100 ERROR pcexec.c 6403 Spell interp failed at bopevt.spl:1243:atev::compute_next_time | bopevt.spl:1021:atev.wait_time::post_val10: AHD04324:Erro na linha 1 coluna 1 da definição. AHD04321:Especificação de data inválida. Linha de erro:0
web:local 19108 ERROR freeaccess.spl 3339 AHD04410:Não é possível encontrar o tipo de dados para o atributo cr from_request
spelsrvr 18100 ERROR pdm_misc.pm 106 Error doing auto_find_assignee AHD05451:cr:513952 Nenhum Grupo qualificado encontrado
Have any of you ever had to do something like that?
Thanx for the help!