Execute a start object task only when certain conditions are met

  • 15 December 2022
  • 2 replies
  • 55 views

Userlevel 4
Badge +5

I wanted a task to let the user fill out some information as long as that information has not been provided. Each time they login they would get this task but as soon as the information was there it would no longer popup. To achieve this I found this topic: 

Open a screen first time and ignore it the next time

However in this topic one of the answers was:

"I'm not sure the suppresses message will work in all (future) GUIs."  here

Since the topic is more than 2 years old I started thinking of a different solution.

The condition to show or hide the task is does the employee table have a record that contains the login user.

dbo.tsf_user()

1. Create task 'provide_user_information'
This task asks for the first name, last name and email address of the employee. The task does not require confirmation, neither does it contain a template

 

2. Create a process flow 'provide_user_information_once'
This flow solely consists of the task 'provide_user_information'

 

3. Create a layout for the task 'lay_provide_user_information'
In this layout check the condition and hide all parameters outside form when the condition is met.
 

if exists(select 1
            from employee e
           where e.login = dbo.tsf_user())
begin
    select @first_name_type    = 3 -- hidden outside form
          , @last_name_type     = 3
          , @email_address_type = 3
end
else
begin
  -- set fields to mandatory
     select @first_name_mand    = 1 -- mandatory
          , @last_name_mand     = 1
          , @email_address_mand = 1
end

 

4. Create a process procedure 'proc_provide_user_information' and assign it to the task
Since we're in a process flow the process procedure will occur. In this procedure we simply check any of the variables whether or not they have been set, if so we execute the insert, else we do nothing. This means that once a task has been executed without information nothing happens.

if   @first_name    is not null 
 and @last_name     is not null
 and @email_address is not null
begin 
  -- do insert
end

 

5. Assign the task in IAM to a user(group) as start object for your application.
Once you've created the above code and synchronized to IAM (do not forget) you can assign your task as a start object to a user or group.

 

A task without parameters just gets executed, since we do not have anything that gets executed nothing happens. But when the employee does not exist the task shows and the user has to fill out the details.

Be aware that starting objects only work when you start the application with IAM, not when you load the metadata/application model from the Software Factory.

Possibly this also works when you do not use a process but just task template logic. I am not completely sure what the best option is there.

 

After executing this task you can do any normal process actions like a decision to decide whether or not more actions need to occur.


This topic has been closed for comments

2 replies

Userlevel 6
Badge +10

@Kasper Reijnders We have something similar in the Universal GUI.

May I ask why you use a Process Flow with a Process procedure instead of a Task template? Task template works for us and eliminates the need for a Process Flow, see my comment here: 

 

Userlevel 4
Badge +5

@Kasper Reijnders We have something similar in the Universal GUI.

May I ask why you use a Process Flow with a Process procedure instead of a Task template? Task template works for us and eliminates the need for a Process Flow, see my comment here: 

 

The reason is that I planned to add more functionality in the flow like opening some documents. In this example I removed all futher steps, so when you only execute one task there is no need for this indeed.