Make Program rule trigger only when the user click on Complete button

Hey everyone!!

Would like to know if there is any possibility to make a program rule triggers only when the user clicks on the complete button at some stage instead of when he/she fills the specific field that I am validating.

I’ve got this specific scenario in that I validate if the user filled or not a field and based on that I show/hide the next program stage. So, Would like to know if there’s a way to make this validation only when the user clicks on the complete button.

See the attached pictures below, the first one is before the validation, the other one is after the validation. Will also attach the program rule expression.



Thanks in advance for your help and support!

Hi @carlos.massavanhane

Welcome back to the community! Yes, you can trigger the action on complete. After creating the program rule expression and when it’s time to select the program rule action, you will be able to select that the rule is only triggered on complete whether as a warning or an error. As an error, the user will not be able to complete the stage and as a warning the user will only be notified but will be able to complete.

Hope this helps!

Thanks for your quick response @Gassim, I don’t know if I make it clear but what is happening is that I already have a program rule and it triggers right after the user fills the field that I am validating. What I would like is that the Program rule to only triggers after the user clicks on the complete button. This is what I have defined now on as the Program rule actions:

Thank @carlos.massavanhane! So you only want to “hide program stage” only after clicking the “complete button”?

1 Like

yeah almost that, but since by default the stage is showing with the program rule I only want to “Show program stage” only after clicking the “complete button”. Let me pictures of all program rule details, expression and actions:



1 Like

Thank you @carlos.massavanhane for your patience! I’ve been thinking and researching about this particular action but there doesn’t seem an out of the box way to get a program rule to trigger when the ‘complete button’ is pressed. For the program rule to trigger, the program rule expression needs to be “activated” and there’s nothing that we can input in the program rule that says ‘if program stage is complete.’

Another approach to make this scenario happen, would be to assign a value to a data element in another stage, and when this value is ‘Yes’ for example, it will trigger to ‘hide program stage’.

Another important note that I would like to add about hiding program stage rule:

And so the wording ‘hide program stage’ might change in the future as well! ([DHIS2-13995] - Jira)


Last but not least, it’s very important sometimes to understand the use case! Would you share more about the use case and why this particular action is important? Maybe there’s a different way to achieve the same goal!

Thank you!

1 Like

Thanks for your attention on this subject, sorry for my delay in response.
So, let me describe the use case:

We are implementing an electronic performance measure instrument for the Gender-Based Violence program from MoH, which is an evaluation made on the health facility where we check the response for cases of GBV. These evaluations are based on specific criteria that can be achieved or not when the criteria are not achieved, the user needs to write an action plan to solve this gap.
For this specific scenario, since the user needs to answer the criteria in order, this program rule is to grant that the user can only move to the next criteria after completing the previous one. So to do that, we decide to hide all criteria (Stages) and just show it when the previous is completed.

I hope I have clarified and I am willing to provide further clarification regarding the above scenario.

Thanks!

1 Like

Hi @carlos.massavanhane;

How did you insert the text in blue?: 1. A US oferece cuidados acessiveis e gratuitos a vitimas de violencia.

Thanks in advance