Olá pessoal, estou com dúvidas quanto ao método starProcess do hAPI.
Quero utilizar os dados de um processo em outro. Vou colocar os codigos abaixo e o resultado no Log. Alguém pode me ajudar me mostrando no que estou errando?
Processo Pai
function afterTaskComplete(colleagueId, nextSequenceId, userList){
// Definindo variáveis
var dadosFormulario = new java.util.HashMap();
if(nextSequenceId == '9'){
dadosFormulario.put("responsavel", "fabio.schmitz");
try{
log.info("################# INICIANDO PROCESSO:");
hAPI.startProcess('WF_ACAO_RAC', 0, ["fabio.schmitz"], "Iniciado pela RAC", false, dadosFormulario, false);
} catch(e){
log.error("################# AKI DEU O ERRO: " + e);
}
}
}
Processo Filho:
function afterTaskSave(colleagueId,nextSequenceId,userList){
if(nextSequenceId == 0 || nextSequenceId == 4){
try{
var resp = hAPI.getCardValue("responsavel");
log.info("################# VALOR DE RESPONSAVEL: " + resp);
hAPI.setCardValue("responsavel_area", resp);
} catch(error){
log.error("################# ERRO AO LER OU DEFINIR O CAMPO: " + error);
}
}
if(nextSequenceId == 5){
try{
var resp = hAPI.getCardValue("responsavel");
log.info("################# VALOR DE RESPONSAVEL NA 5: " + resp);
hAPI.setCardValue("responsavel_area", resp);
} catch(error){
log.error("################# ERRO AO LER OU DEFINIR O CAMPO: " + error);
}
}
}
Testei em diversos eventos de processo como: (afterStateEntry, afterProcessCreate, beforeStateEntry) e em todos está como nulo.
Log:
2024-07-29 11:32:49,344 INFO [com.datasul.technology.webdesk.customization.ScriptingLog] (default task-4828) ################# INICIANDO PROCESSO:
2024-07-29 11:32:49,370 INFO [com.datasul.technology.webdesk.workflow.business.WorkflowBO] (default task-4828) Iniciando o processo 'WF_ACAO_RAC' ativ destino '5' usuario 'fabio.schmitz' empresa '1'
2024-07-29 11:32:49,585 INFO [com.datasul.technology.webdesk.customization.ScriptingLog] (default task-4828) ################# VALOR DE RESPONSAVEL: null
2024-07-29 11:32:49,588 ERROR [com.datasul.technology.webdesk.customization.ScriptingLog] (default task-4828) ################# ERRO AO LER OU DEFINIR O CAMPO: JavaException: java.lang.NullPointerException: null
2024-07-29 11:32:50,185 WARN [com.datasul.technology.webdesk.workflow.engine.WorkflowEngine] (default task-4828) Não existe nenhum anexo definido como principal.
2024-07-29 11:32:50,186 WARN [com.datasul.technology.webdesk.workflow.engine.WorkflowEngine] (default task-4828) Não existe nenhum anexo definido como principal.
2024-07-29 11:32:50,186 INFO [com.datasul.technology.webdesk.workflow.business.WorkflowBO] (default task-4828) # Saving card. Process: WF_ACAO_RAC, Instance: 20189, Sequence: 5, Dados: {responsavel=fabio.schmitz}
2024-07-29 11:32:50,245 WARN [com.datasul.technology.webdesk.workflow.engine.WorkflowEngine] (default task-4828) O campo da ficha não foi encontrado: 91718 responsavel
2024-07-29 11:32:50,245 INFO [com.datasul.technology.webdesk.customization.ScriptingLog] (default task-4828) ################# VALOR DE RESPONSAVEL NA 5: null
2024-07-29 11:32:50,373 INFO [com.fluig.monitoring.jschronos.JSChronos] (default task-4828) CustomizationManagerImpl.invokeFunction.afterTaskComplete executou por 1 segundo
2024-07-29 11:32:50,696 WARN [org.apache.activemq.artemis.core.client] (EJB ASYNC - 33) AMQ212051: Invalid concurrent session usage. Sessions are not supposed to be used by more than one thread concurrently.: java.lang.Exception: trace