BPM, Workflow, and Case

 View Only

 How to attribute button's name (label) according to task name ?

Marco Mafra's profile image
Marco Mafra posted Tue July 01, 2025 11:12 AM

Hi all !

We are working on a process that at some point there are 3 reviews tasks. 
The idea it to change dinamically the button's label according to taskname (Revisão Gramatical).
In this case, when the task is "Revisão Gramatical" the button's label have to have a different name from it's predecessor reviews activities,

I create and variable "tipoRevisao" and setup it to button's label.


Then, I included the following script (pre execution).


if (tw.system.processInstance.task.processActivityName == "Revisão Gramatical"){

//Label of the button
tw.local.tipoRevisao = "Encaminhar para Validação do Redator";
} else {
//Label name of the button
tw.local.tipoRevisao = "Encaminhar à próxima revisão";
}

But when I execute the coach, the CP4BA is returning and error message.


There is a video capture for better understanding.
Anyone have any tip or suggestion to fix that ?

Rgds, M
Marco Mafra's profile image
Marco Mafra

Hi people !

It has already solved. The logic, methods and proramming are fine.
We are testing the scenario in Debug mode insteade in execution mode via "play button of studio" or via "workplace".

  • In "debug" mode, CP4BA does not create an instanceId / instance number.
  • As We are using an object that clains for instance (tw.system.processInstance....), it causes the failure/error.

When We tested in execution, mode the instance is created and there is no failure/error.

So, whenever in your scripts you uses an objected tied to "instance" , test your code or coach of flow using execution mode.

Regards, M