How to force dirty state of screen before the form is loaded

Can I force Dirty state of screen before the form is loaded?

I create new protocol using WF. The last screen is configured to “Allow Save” and I want to have a “dirty state” of the screen here.

Initial screen is not dirty, so the user can easilly close the form and then she must start again:

obrazek

The easiest way would be to force the dirty state before the screen is displayed.

If the screen would be dirty, what would you expect? User could still save it. It looks like, you need some sort of input from the user, otherwise the workflow result is not valid. If it is the case, I recommend not using the AllowSave feature and an extra workflow should be implemented and used as Save button. You will then get access to validation.

I think that’s exactly the case. The problem is that when the screen appears it is not dirty - only after the first user edits. So the aim is to make the screen dirty right when it gets to this step.

1 Like

Yes, I generate the default data into the screen and I want to display the screen to user as “dirty”, it is new object and user is suppossed to SAVE it, otherwise everything pregenerated would be lost when the user close the tab without saving the data.

User can close the screen without any warning, so the only way how to open the screen again is that the user needs to start workflow again.

So I expect:

  1. I show the screen to user in dirty mode, because I want him to show that the data needs to be saved
  2. This state would also block the user to close the tab without being asked whether to save data or not

Your suggestion to use extra WF button wouldn’t work I guess:

  1. WF button is just a normal button without indicating Changed state, it won’t become red and it would not block the user to close the tab (screen) without beeing asked whether he wants to save the current form. So the user would be able to close the screen and quit the workflow
  2. I need to design another WF

Another solution could be NEXT button and save step after pressing next

  1. This would hold the user inside workflow
  2. But it is not as user friendly as SAVE button, especially when the button is red indicating there is something to save.

How many UI steps does your workflow have?

I don’t see this question as relevant.

But anyway, this particular workflow has 2 steps:

  1. User opens the form using menu
  2. User selects order from dropdown
  3. User clicks on the next button and the data is ready to save

If there would be just one UI step, it could be managed by a standard screen with workflow data method where there are means to force dirty state. Still the first step looks like something that can be handled by selection dialog.

So you mean:

  1. Use selection dialog
  2. pass the parameter into the screen
  3. Use default template as initialization of data as I need to load some data from other entities.

I am not sure how can I pass the parameter from selection dialog into Default template.

Isn’t it getting complicated? Wouldn’t be actually “initial dirty state” useful even for more complicated workflows?

I think we should document this use case first in Data Structure Workflow Method so it is easier to explain.

Are you sure we support loading data through this method while allowing of saving? I thought these were read only.

  1. Use default template as initialization of data as I need to load some data from other entities.

I mean Data Structure Workflow Method.

Isn’t it getting complicated? Wouldn’t be actually “initial dirty state” useful even for more complicated workflows?

I think it is case by case problem. There are situations when the dirty state is not desired.

I think we should document this use case first in Data Structure Workflow Method so it is easier to explain.

I agree.

Are you sure we support loading data through this method while allowing of saving? I thought these were read only.

I’m pretty sure (I’m using it this way). Workflow method is relevant only for loading data.

Hi,

thank you for your responses.

Summary

If I remodel the case using Load Workflow Method, would it bring me screen in edit mode into a “dirty state”? So that after the opening screen I will see the SAVE button red? That would probably solve this particular use case.

You mentioned earlier:

there are means to force dirty state.

What kind of means? Could you be please more specific? I just want to be sure if I remodel it this way, it would satisfy my use case.

I agree. But what about setting Workflow property as we use for title or notifications? That would be quite straightforward to configure this behaviour in cases when it is needed?


I was asking first if there is already some way how to force the screen to become dirty. As I understand now, in workflow there is no such functionality at this moment. But we might achieve the expected behaviour using workflow load data method combined with selection dialog (for 2 steps worfklow).

I’ve tried to create a sample covering this case to make sure I’m right in what I’m stating and alas I wasn’t right. Unfortunately I was basing my information on older versions of Origam, where it was sufficient to touch a virtual field in the workflow method to put dataset into dirty state. We even had to introduce a special workflow step AcceptContextStoreChanges (Forcing not dirty status in screens with workflow method).

In current version even setting a database field to a dirty state won’t yield dirty state in the UI. Dataset delivered from workflow method is handled as unchanged (not dirty). I can’t find the pull request responsible for this change, but I suspect it is the impact of change how worfklow handles context store state on input.

To sum it up - at the moment it is not possible to force dirty state and there were some changes with more profound impact than initially expected.

@david.pochobradsky After internal discussion we have created following tasks:

I’m not sure if we manage them in 2024.2, otherwise they will be included in 2024.3.

1 Like