Table of Contents

Class BPMEventVO

Namespace
PHCBusinessLayer
Assembly
PHCBusinessLayer.dll

Workflow events, start and end

[AttTable("BPMEvent", 20240311)]
[AttTableVOInfo(typeof(BPMWorkflowAttInfo))]
public class BPMEventVO : BPMElement, IBaseSerialization, ICloneVO, ICloneable, IChange, IGenericVO, IParent<BPMProcessVO>, IParent
Inheritance
BPMEventVO

Fields

CodeOnAnchor

Sequence of execution of events within the element

public const string CodeOnAnchor = "OnAnchor"

Field Value

string

CodeOnEnd

public const string CodeOnEnd = "OnEnd"

Field Value

string

CodeOnInit

public const string CodeOnInit = "OnInit"

Field Value

string

CodeOnRule

public const string CodeOnRule = "OnRule"

Field Value

string

CodeOnStatus

public const string CodeOnStatus = "OnStatus"

Field Value

string

Properties

GetFieldStampName

Use only field name without table name

public override string GetFieldStampName { get; }

Property Value

string

GetStampValue

public override string GetStampValue { get; }

Property Value

string

RoleVO

Instance of RoleVO, permission

[AttExternalCollection(typeof(RoleVO), new string[] { "pfstamp", "[BPMEvent].[pfstamp]" })]
public RoleVO RoleVO { get; }

Property Value

RoleVO

UserVO

Instance of UserVO, permission user

[AttExternalCollection(typeof(UserVO), new string[] { "usstamp", "[BPMEvent].[usstamp]" })]
public UserVO UserVO { get; }

Property Value

UserVO

actionCode

Action code when entityanchor = BPMEntityAnchors.Action

[AttLenght(60)]
public string actionCode { get; set; }

Property Value

string

actionSuggested

Suggested action

public bool actionSuggested { get; set; }

Property Value

bool

actionname

Title of the action, if empty it assumes the value of BPMProcessVO.name

public string actionname { get; set; }

Property Value

string

anchortype

Anchor type

public AnchorTypes anchortype { get; set; }

Property Value

AnchorTypes

anchortypename

Anchor type name

[AttLenght(60)]
[AttLocale(typeof(BPMWorkflowAttInfo), new string[] { "[BPMEvent].[anchortype]" })]
public string anchortypename { get; set; }

Property Value

string

attachmentcount

Mandatory attachment count

[AttEntityAvailable(typeof(AnexosVO))]
public int attachmentcount { get; set; }

Property Value

int

bpmeventstamp

Unique ID

[AttLenght(25)]
public string bpmeventstamp { get; set; }

Property Value

string

bpmprocessstamp

Connection to BPMProcessVO

[AttForeignKey(typeof(BPMProcessVO))]
[AttLenght(25)]
public string bpmprocessstamp { get; set; }

Property Value

string

connectioncount

Mandatory connection count

public int connectioncount { get; set; }

Property Value

int

demandCode

On-demand start code when anchortype = AnchorTypes.OnDemand

[AttLenght(60)]
public string demandCode { get; set; }

Property Value

string

elementtype

Element type

public override BPMElementTypes elementtype { get; set; }

Property Value

BPMElementTypes

entityanchor

Entity anchor type

public BPMEntityAnchors entityanchor { get; set; }

Property Value

BPMEntityAnchors

entityanchorname

Entity anchor type name

[AttLenght(60)]
[AttLocale(typeof(BPMWorkflowAttInfo), new string[] { "[BPMEvent].[entityanchor]" })]
public string entityanchorname { get; set; }

Property Value

string

entitycode

Entity code (CL, ST, ...)

[AttLenght(60)]
public string entitycode { get; set; }

Property Value

string

entitycodename

[AttLocale(typeof(BPMWorkflowAttInfo), new string[] { "[BPMEvent].[entitycode]" })]
[AttList(Hidden = true)]
[AttVirtualField]
public string entitycodename { get; set; }

Property Value

string

entityserie

Entity serie code (58, 32)

[AttLenght(30)]
public int entityserie { get; set; }

Property Value

int

entityseriename

Entity serie code name (Fatura, Encomenda de cliente)

[AttLenght(60)]
public string entityseriename { get; set; }

Property Value

string

entityseriestamp

Entity serie stamp

[AttLenght(25)]
public string entityseriestamp { get; set; }

Property Value

string

eventtype

Event type

public BPMEventTypes eventtype { get; set; }

Property Value

BPMEventTypes

eventtypename

Event type name

[AttLenght(60)]
[AttLocale(typeof(BPMWorkflowAttInfo), new string[] { "[BPMEvent].[eventtype]" })]
[AttFieldType(new AttFieldType.FieldFlags[] { AttFieldType.FieldFlags.isReadOnly })]
public string eventtypename { get; set; }

Property Value

string

instructions

Instructions

[AttFieldType(AttFieldType.InputTypes.memo)]
public string instructions { get; set; }

Property Value

string

listaction

Determines whether the action is list mode (True) or detail mode (False)

public bool listaction { get; set; }

Property Value

bool

onanchor

Código de acesso

[AttFieldType(AttFieldType.InputTypes.memo)]
public string onanchor { get; set; }

Property Value

string

Neste código devemos retornar um valor lógico de verdadeiro para indicar que o arranque é valido, o contexto é muito reduzido, apenas temos acesso á variável 'payload' passada por parâmetro e não existe qualquer tipo de contexto do workflow ou dos seus elementos, nem sequer está dísponivel o SDK de BPM.

Remarks

Código para definir condições adicionais do acesso ao tipo de arranque definido neste evento, se o arranque definido, for por exemplo, uma ação para o ecrã de clientes, podemos aqui escrever código que faça com que essa ação esteja dísponivel apenas para clientes cuja data de nascimento esteja preenchida.

Parametros payload = Contexto fornecido.

Exemplo de regra de acesso Dim cliente as ClVO = DirectCast(payload, ClVO) If Not cliente.nascimento.IsVoid() Return True End If

onend

Código de fim

[AttFieldType(AttFieldType.InputTypes.memo)]
public string onend { get; set; }

Property Value

string

Qualquer retorno de mensagens ou erro de execução é ignorado, pois não é possivel cancelar o fim da execução de um evento, no entanto todas as mensagens retornadas são registradas no log do workflow.

Remarks

É o último código a correr no elemento, pode usar 'SDKBPM' para facilmente aceder ao SDK do BPM e assim efetuar as operações desejadas.

Payload Se o worflow foi iniciado a partir do ecrã de clientes quando se consultava o cliente João, esses dados estão dentro do workflow através de uma variável especial e em qualquer altura da execução do workflow pode-se obter esses dados da seguinte maneira:

Dim cliente as ClVO = SDKBPM.GetPayload(Of ClVO)()

Contexto SDKBPM.GetProcess() = Tipo de workflow iniciado BPMProcessVO SDKBPM.GetWorkflow() = Workflow iniciado BPMInstanceVO SDKBPM.GetActivity() = Atividade que está a ser processada BPMActivityVO

SDKBPM.GetElement() = Elemento que deu origem á atividade BPMElement SDKBPM.GetElement(Of BPMEventVO)() SDKBPM.GetElement(Of BPMFlowVO)() SDKBPM.GetElement(Of BPMGatewayVO)() SDKBPM.GetElement(Of BPMActionVO)()

Definir valores de variáveis SDKBPM.SetVar('Cod02', 'Meu resumo inicial')

Obter valores de variáveis SDKBPM.GetVar('Cod02'), retorna Object SDKBPM.GetVar(Of String)('Cod02'), retorna String

oninit

Código de inicialização

[AttFieldType(AttFieldType.InputTypes.memo)]
public string oninit { get; set; }

Property Value

string

Atenção, se for retornada alguma mensagem de erro 'MsgError' ou ocorrer erro na execução do código, o workflow é cancelado, isto só se aplica ao evento iniciar, no evento de fim, qualquer retorno de mensagens ou erro de execução é ignorado, pois não é possivel cancelar o fim de um workflow, no entanto todas as mensagens retornadas são registradas no log do workflow.

Remarks

É o primeiro código a correr no elemento, é a altura ideal para definir valores para as variáveis, ou alterar outras configurações do workflow ou da atividade que está a ser processada, pode usar 'SDKBPM' para facilmente aceder ao SDK do BPM e assim efetuar as operações desejadas.

Payload Se o worflow foi iniciado a partir do ecrã de clientes quando se consultava o cliente João, esses dados estão dentro do workflow através de uma variável especial e em qualquer altura da execução do workflow pode-se obter esses dados da seguinte maneira:

Dim cliente as ClVO = SDKBPM.GetPayload(Of ClVO)()

Contexto SDKBPM.GetProcess() = Tipo de workflow iniciado BPMProcessVO SDKBPM.GetWorkflow() = Workflow iniciado BPMInstanceVO SDKBPM.GetActivity() = Atividade que está a ser processada BPMActivityVO

SDKBPM.GetElement() = Elemento que deu origem á atividade BPMElement SDKBPM.GetElement(Of BPMEventVO)() SDKBPM.GetElement(Of BPMFlowVO)() SDKBPM.GetElement(Of BPMGatewayVO)() SDKBPM.GetElement(Of BPMActionVO)()

Definir valores de variáveis SDKBPM.SetVar('Cod02', 'Meu resumo inicial')

Obter valores de variáveis SDKBPM.GetVar('Cod02'), retorna Object SDKBPM.GetVar(Of String)('Cod02'), retorna String

onlyoneactive

Only one workflow active

public bool onlyoneactive { get; set; }

Property Value

bool

Remarks

It only allows you to create a new workflow of the same type, when there is no workflow active with the same record linked. Only work if (anchortype = AnchorTypes.EntityEvent or AnchorTypes.EntityAction) and not entitycode.IsVoid

onrule

Código de confirmação

[AttFieldType(AttFieldType.InputTypes.memo)]
public string onrule { get; set; }

Property Value

string

Se for retornada alguma mensagem de erro 'MsgError' ou ocorrer erro na execução do código, o workflow continua no estado de necessitar de confirmação pelo utilizador, qualquer tipo de mensagem retornada é mostrada ao utilizador e também registrada no log do workflow.

Remarks

Este código só é executado se o elemento evento de inicio estiver configurado que para iniciar o workflow é necessário confirmação pelo utilizador, neste código podemos escrever as regras de negócio para validar essa confirmação, pode usar 'SDKBPM' para facilmente aceder ao SDK do BPM e assim efetuar as operações desejadas.

Payload Se o worflow foi iniciado a partir do ecrã de clientes quando se consultava o cliente João, esses dados estão dentro do workflow através de uma variável especial e em qualquer altura da execução do workflow pode-se obter esses dados da seguinte maneira:

Dim cliente as ClVO = SDKBPM.GetPayload(Of ClVO)()

Contexto SDKBPM.GetProcess() = Tipo de workflow iniciado BPMProcessVO SDKBPM.GetWorkflow() = Workflow iniciado BPMInstanceVO SDKBPM.GetActivity() = Atividade que está a ser processada BPMActivityVO

SDKBPM.GetElement() = Elemento que deu origem á atividade BPMElement SDKBPM.GetElement(Of BPMEventVO)() SDKBPM.GetElement(Of BPMFlowVO)() SDKBPM.GetElement(Of BPMGatewayVO)() SDKBPM.GetElement(Of BPMActionVO)()

Exemplo de regra de confirmação If SDKBPM.GetVar(Of String)('Cod02').IsVoid() listMsg.Add(New MsgError($'Deve preencher o valor da variável {SDKBPM.GetVarTitle('Cod02')}')) Return listMsg End If

Definir valores de variáveis SDKBPM.SetVar('Cod02', 'Meu resumo inicial')

Obter valores de variáveis SDKBPM.GetVar('Cod02'), retorna Object SDKBPM.GetVar(Of String)('Cod02'), retorna String

onstatus

Código de estado

[AttFieldType(AttFieldType.InputTypes.memo)]
public string onstatus { get; set; }

Property Value

string

Se for retornada alguma mensagem de erro 'MsgError' ou ocorrer erro na execução do código, a alteração do valor do estado é cancelada mas o workflow continua em execução, todas as mensagens retornadas são registradas no log do workflow, no evento de inicio, se tiver momento de confirmação pelo utilizador, este código só corre após existir e ser validada essa confirmação.

Remarks

Código para definir o valor do estado a ser aplicado ao workflow e á atividade que está a ser processada, pode usar 'SDKBPM' para facilmente aceder ao SDK do BPM e assim efetuar as operações desejadas.

Payload Se o worflow foi iniciado a partir do ecrã de clientes quando se consultava o cliente João, esses dados estão dentro do workflow através de uma variável especial e em qualquer altura da execução do workflow pode-se obter esses dados da seguinte maneira:

Dim cliente as ClVO = SDKBPM.GetPayload(Of ClVO)()

Contexto SDKBPM.GetProcess() = Tipo de workflow iniciado BPMProcessVO SDKBPM.GetWorkflow() = Workflow iniciado BPMInstanceVO SDKBPM.GetActivity() = Atividade que está a ser processada BPMActivityVO

SDKBPM.GetElement() = Elemento que deu origem á atividade BPMElement SDKBPM.GetElement(Of BPMEventVO)() SDKBPM.GetElement(Of BPMFlowVO)() SDKBPM.GetElement(Of BPMGatewayVO)() SDKBPM.GetElement(Of BPMActionVO)()

Definir o valor de estado SDKBPM.SetStatus("Em Aprovação")

Definir valores de variáveis SDKBPM.SetVar('Cod02', 'Meu resumo inicial')

Obter valores de variáveis SDKBPM.GetVar('Cod02'), retorna Object SDKBPM.GetVar(Of String)('Cod02'), retorna String

pfname

Permission name

[AttLenght(60)]
[AttVirtualField(typeof(BPMWorkflowAttInfo))]
public string pfname { get; set; }

Property Value

string

pfstamp

Connection to RoleVO

[AttForeignKey(typeof(RoleVO), HiddenField = false)]
[AttLenght(25)]
public string pfstamp { get; set; }

Property Value

string

roletype

Role type

[AttLenght(2)]
public RoleTypes roletype { get; set; }

Property Value

RoleTypes

roletypename

Role type name

[AttLenght(60)]
[AttLocale(typeof(BPMWorkflowAttInfo), new string[] { "[BPMEvent].[roletype]" })]
public string roletypename { get; set; }

Property Value

string

status

Status

[AttLenght(40)]
public string status { get; set; }

Property Value

string

usname

Permission user name

[AttLenght(60)]
[AttVirtualField(typeof(BPMWorkflowAttInfo))]
public string usname { get; set; }

Property Value

string

usstamp

Connection to UserVO, permission user

[AttForeignKey(typeof(UserVO), HiddenField = false)]
[AttLenght(25)]
public string usstamp { get; set; }

Property Value

string

variables

Local variables

[AttCollection(typeof(BPMVarRefVO), new string[] { "[BPMVarRef].[oristamp]", "[BPMEvent].[bpmeventstamp]" })]
public List<BPMVarRefVO> variables { get; set; }

Property Value

List<BPMVarRefVO>

waitstate

Wait state

public bool waitstate { get; set; }

Property Value

bool

Methods

SetStampValue(string)

public override void SetStampValue(string stampID)

Parameters

Nome Tipo Descrição
stampID string

ToString()

public string ToString()

Returns

string

Explicit Interface Implementations

ParentVO

BPMProcessVO ParentVO { get; set; }

Returns

BPMProcessVO