Let Microflow wait for user input

0
Hello, I've encountered the following problem in building a microflow: I have a microflow to calculate a value for an attribute of an object. This value is calculated using answers from a survey. When starting the survey you can first select the object to calculate the value for from a reference selector. The microflow I've made has the following features: It starts when the user presses the button new survey. Then a new survey object is created and next the survey form is shown. I now want the microflow to wait for the user to finish filling out this form. When the user presses save, I want the microflow to calculate the value. Also the microflow should notice when the survey is being filled out for the second time. The microflow should then prompt the user and ask for confirmation (I've done this using a new form, the ConfirmMicroflow widget did not work). I've tried using event handlers, but this does not work. The microflow creates a infinite loop. So in essential: How to make a microflow wait for user input? Thank you Edwin for your answer. Unfortunately filling out the surveys has to be done by one user, so associating with currentuser is not possible. I now want to try the following: When pressing new survey first there is a form to choose a person identifier, this empty survey is saved. It only contains a person identifier and a survey identifier. After save i'd like the second MF to kick in. This one retreives the survey using the identifier. This second MF removes the identifier after completion so the same trick can be used again. How do I get a microflow to run after that specific save button? It can run after commit, because that would create a loop. Any suggestions?
asked
3 answers
3

Max,

You can't let a microflow wait for the user input. So the MF you created creates the new survey and shows the form. Then build a second microflow and replace the save buuton on the from shown by the first MF by a MF-trigger (button) that handles the calculation. If you want to see if the survay has already been filled you'll have to store this somewhere. So maybe on create of the survey have the survey associated with the user entity and create the association with the first MF and then in the second MF try to retrieve the survey with the association to the user (currentuser) and count the resulting list. In that way you can see if the survey has already been filled by the user.

Optionally to make a microflow "wait for the user" you could try something with the microflow timer from the app store. This can trigger until a condition is met e.g. Although this is not very pretty and might cause performance loss depending on the actions that you're doing in the MF. I would recommend the first suggestion.

answered
2

Max,

A second try: You have a survey entity with some references. You have a form that displays the survey entity with the reference selectors. Based on the selections you want to calculate something. You want to know if the survey has been filled for a particular person already. If so then a yes/no question needs to be asked, asking for confirming if the user wants to fill the survey for a second time or overwriting the survey e.g.

For this to work: On the survey overview form make sure a form is opened with a new survey entity in a dataview displaying the reference selector for the person. Add a MF button that will retrieve the surveys that have the same person selected. With a split check if something is returned.

First the if nothing is returned part: after the split perform a change object action for the survey (this saves the survey with the reference to the person. The add an action to open a second form with a dataview of the survey entity, but now with the reference selectors (so the user can answer the questions) the input for this open form action is the survey that server as the input for the MF. The calculation can be done by means of an event MF, so make sure the first save is done without events.

Now for the case where there is already a survey filled with the same person referenced. It depends on what the user can choose. If you would like to overwrite the previously filled in survey then perform a change action on the retrieved survey making sure the references are cleared e.g. and in the next step open the retrieved survey in stead of the survey that served as input.

If you want to ask the user if he wants to fill in a second survey for the same person then the steps are some more elaborate:

You'll need to add an entity for asking the question with a boolean and a relation to the person entity (same as for the survey), lets call the entity QUEST. Now in the action after the split create a new QUEST object then retrieve the person object from the survey and in the third step change the newQEUST entity by setting the relation to the person with the retrieved person. As a last step open the form with the QUEST entity. On the QUEST entity form add a MF button that handles the save and if the boolean is set to yes (I want to create a second survey for the same person) add actions to retrieve the person from the QUEST entity record, create a new Survey record, Change object NewSurvey setting the reference to the retrieved person and as a last step open the NewSurvey entity in the form that allows for answering the questions.

I hope this helps,

Erwin

answered
0

How do I get a microflow to run after that specific save button? It can run after commit, because that would create a loop. Any suggestions?

Replace the Save button with a "custom" Save button, iow, paste a Microflowtrigger which you'd name "Save"and which does what you need to get done.

I have several "questionaire" like screensequences that are handeled that way

answered