Como acessar o bloco de anotações do fluxo de trabalho a partir das regras de negócio
Um item do catálogo foi solicitado e o fluxo de trabalho anexado contém uma atividade de execução de script que preenche um valor no bloco de anotações. Em uma regra de negócio em execução no item solicitado, você deseja recuperar ou definir valores de bloco de anotações.
Pré-requisitos
Função necessária: administrador
Nome: acesse o bloco de anotações de fluxo de trabalho a partir das regras de negócio.
Tipo: regra de negócio.
Tabela: sc_req_item (Item solicitado).
Descrição: um item do catálogo foi solicitado, o fluxo de trabalho anexado contém uma atividade de script de execução que preenche um valor no bloco de anotações. Em uma regra de negócio em execução no item solicitado, você deseja recuperar ou definir valores de bloco de anotações.
Parâmetros: n/a.
Script:
//the run script activity sets a value in the scratchpad
workflow.scratchpad.important_msg = "scratch me";
//get the workflow script include helper
var workflow = new Workflow();
//get the requested items workflow context
//this will get all contexts so you will need to get the proper one if you have multiple workflows for a record
var context = workflow.getContexts(current);
//make sure we have a valid context
if (context.next()) {
//get a value from the scratchpad
var msg = context.scratchpad.important_msg;
//msg now equals "scratch me", that was set in the run script activity
//add or modify a scratchpad value
context.scratchpad.status = "completed";
//we need to save the context record to save the scratchpad
context.update();
}