Solved

How to start a process flow containing a message with options?

  • 12 November 2020
  • 6 replies
  • 268 views

Badge +1

I made a process flow with (only) a message with options so I can define the actions depending on the user’s response.

How does this process flow start? I presumed I could just use the message in my code and trigger the process flow with that but it doesn’t work.

I want to use it in a default procedure in which I want to send a warning before deleting a row in another table. In this warning I ask ‘ are you sure?’ . When the answer is no, the process stops.
It seems I cannot define a starting point in the process flow. When I use the message now, I don’t get the options in it.

It has to be simple isn’t it…...if you know what to do 🙂?

icon

Best answer by Mark Jongeling 5 February 2021, 12:19

View original

6 replies

Userlevel 7
Badge +23

Hi Saskia,

The 'Show message’ process action cannot be the starting point of a process flow. It is possible to, for example, start the process flow with the task you were executing or action you were taking that results in the message. 

You can enable the 'Confirm delete’ setting in the Software Factory at Subjects → [your table] → Settings (General tab). This will show the user a message letting them confirm they intend to delete the record. The GUI will give a standard confirmation message. If you want to show different text, go for the alternative I talk about next.

Subjects → [your table] → Settings (General tab)

 

Alternatively you could disable the delete button and create a task that will do the delete instead. With tasks it is possible to start a process flow. Then you can select a confirmation message that the task will present to the user. There the message options will have effect as, in combination with the process flow and the [Status code], it can guide the user.

In Messages, you can add message options and translate them however you'd like and even attach an icon if desired.

Standard any confirmation message has two options, Yes and No. So the entries above are not mandatory. Only if you'd like to change the button text.

I hope this helps you out Saskia!

Kind regards,
Mark Jongeling

Badge +1

Thank you @Mark Jongeling for your answer, but it’s not a delete action from the user through a button or task I’m talking about.

I want to use a message in a default procedure. So, after the if statement (boolean = N), I am going to delete a row in another table. But, if there are data in this row, the user get’s a message. I would like them to choose if the row will be deleted or not. 

Strangely enough, if I use a message in my code with severity error, the action is still taken, which is not described as such. 

 

Userlevel 7
Badge +23

A message raised by the Default procedure cannot return it's status code to the procedure so it would never know what the user pressed (Yes/no). 

Could you elaborate on this more? Deleting a row in a (different) table within a Default procedure is not something I would recommend. Why does this happen in the Default?

If I understand the workflow you are trying to achieve, then I can help you find a suitable solution. 

Kind regards,
Mark Jongeling

Badge +1

Hi Mark,

The problem is indeed still not resolved. I’ll try to explain better.

We have a boolean/switch, include pickup (or delivery). When the outcome is Y, a transport row is created, the pickup or delivery: 

if @cursor_from_col_id = 'include_pickup'begin if @include_pickup = 1 begin INSERT INTO Transport (shipment_id, sequence, routing_type, modality_id, transport, contract_id,                                pickup_accou etc.

When the boolean/switch is turned back to N, the transport row has to be deleted. But, users can have added new data to this row. We check this before and want to give a warning. Can the row be deleted or do you want to remove the data first? 

Check:

 else if @include_pickup = 0 and @is_deleted = 0 begin if (           @cost is not NULL or @transport_contract_id is not NULL or @pickup_transport_date_actual is not NULL or @pickup_remarks is not NULL or

After check:

begin exec dbo.tsf_send_message 'warning_delete_transport', null, 1 end else begin --exec dbo.tsf_send_message 'warning_delete_tr_pickups', null, 1 --rollback; --return; UPDATE transport SET is_deleted = 1 WHERE shipment_id = @shipment_id and routing_type = 'Pickup' end

In between are some things I tried.

So I would like to execute a message here with options so that I can define the actions after that. In the current code, I thought with a 1 the action is not executed, it’s also severity error, however the transport row is deleted anyhow. 

With rollback/return, there were other problems, I thought the db gave different data than the actual situation. 

Maybe I have to start from the changed switch in the process flow. A colleague tried but did also not succeed in the flow we would like to create. 

Maybe support by phone is easier, to look how to make this process flow? 

I look forward to your answer. I’m not working on this all the time, but in several cases in our application this would be very useful. 

Thank you in advance, gr Saskia

 

 

 

 

 

 

Userlevel 3
Badge +5

Hi Saskia,

Not sure if I understand it correctly, but the problem seems to be that tsf_send_message does not have any output-parameters. This means that if a user presses one of the buttons (message_options) then this will not be returned to the calling code.

Maybe an idea to add output-parameters to tsf_send_message (or another stored procedure that does return the result of the pressed button).

A potential work-around could be to make this boolean not changeable through an edit-action, but only through a dedicated task. This task could then have either a confirmation-message or be the beginning of a process flow.

Something different could be to have a toggle show up in the form in which the user could indicate his/her choice. An additional trigger could then use this choice to continue (or not) deleting transport-row.

Userlevel 7
Badge +23

To all interested,

This question has been resolved. The trouble was the difference in using Messages in the Default procedure and when using Messages in Process Flows. By showing a Message using tsf_send_message in SQL code/Default, the GUI does not send the response to the SQL code again. Meaning the Default procedure, in this case, does not know what the user clicked. Based on that it is not possible to start an action, in this case a delete action.

By using the 'Show message’ process action and utilizing Message options it becomes possible to start other actions and/or guide the user in a specific way.

And in this way it was possible to create the Process flow Saskia was looking for. When a row was edited and a certain column value was changed, the process flow would then continue doing what it needs to do, and else it would stop the process when the row was edited but the certain column value was not changed.

 

Reply