Solved

Can one process variable be used as the variable in another process variable?

  • 1 September 2022
  • 8 replies
  • 87 views

Userlevel 2
Badge +5

Let me give some context: I am making a process for an employee when he initiates his resignation, an email will be sent to the HR and his manager.

In this process I have an process variable which store the employee id of current user. Now I want to use this in the email body of the smtp connector where the name of the employee will be sent.

The email is getting generated, however the place for the name of the employee is blank.

Attaching the flow below.

Process to start the resignation tab and send the email after the row is added.

Below is the process variable to get the name of the employee from the employee id

process variable using another process variable {employee_id}

 

The SMTP input:
 

 

 

icon

Best answer by Vincent Doppenberg 2 September 2022, 16:56

View original

This topic has been closed for comments

8 replies

Userlevel 6
Badge +4

Hello Rucha,

This is not possible in a default value expression, because the default value expression is only evaluated once, at the start of the process flow. However, you can achieve this by using a process procedure, which is intended for this purpose.

In the process procedure you can read and set the values of all process variables, so you can do something like this:

set @process_variable_1 = (select my_column from my_table where id = @process_variable_2)

A process procedure is a stored procedure that is fired after a process action has completed. To use a process procedure, check the following checkbox on a process action:

 

The code group corresponding to process procedures is PROCESSES:

 

I hope this helps.

Userlevel 2
Badge +5

Hi Vincent,
Thanks for the reply. I tried it , however got below error:

Error in the control procedure

 

Userlevel 7
Badge +23

Hi Rucha, 

You may need to Generate the Processes code group; or execute the Generate definition process. This will make sure that the code will get the process variables of the process flow. Thereafter your code can be deployed successfully.

Userlevel 2
Badge +5

Thanks Mark, however its coming after I executed Generate . I have applied it on the Decision process action.
 

 

Userlevel 7
Badge +23

Can you make sure these options are selected?: 

This will make the variables available (after Generate code group):

 

Userlevel 2
Badge +5

Yes they are both checked for the 2 variables I am using.

 

Userlevel 6
Badge +4

Hello Rucha,

After adding a process variable or changing any of the checkboxes in the Performance tab of Process variable, you will have to generate the PROCESSES code group in the Assigning tab of Control Procedure.

 

Can you try this and then press the Generate button in the Result tab again?

I hope this helps.

Userlevel 2
Badge +5

Thanks Vincent and Mark. Its working now! :)