UiPath Forms in For Each Loop Not giving output after first iteration

Hello Team,

I am working on UiPath form and when I loop this form in For Each i observed that for first iteration it is working fine but when second iteration starts it is not giving any output value.
For first iteration everything works fine as i have used conditional text blocks and all. It is working fine with buttons also as a result i am getting value in button variable (out) and formsfieldOutputData but when it loops back to 2nd iteration Form opens and when i click on edit button bot bot moves to next activity that is outside Form. Rather it has to go in do block and perform switch case activity for edit button.
I am not getting why this is happening as it is perfectly working for 1st iteration.
I debug the code before 1st nd 2nd iteration. for both instances values are null at starts.
Here are screenshot of flow and results :–

Please anyone can help me out.

@loginerror , @Andra_Buica , @Pablito @Palaniyappan

Before 1st iteration:


After First Iteration :

Before 2nd Iteration :


after 2nd iteration :

Here instead of going to submit it is going outside Form activity.

Is these variable assigned back to null once after first iteration

I think we are missing with condition block
May be run in debug mode with some slow steps so that we can track where the flow is moving


Yes those variables are get back to null values.
I have attached those screenshot above.

Yes i tracked flow : -

when 1st iteration is executing all buttons are working like when i click on editProcess bot executes do block in that it executes editProcess in switch . after that as per logic and condition text field appears with dropdown. and when we clic on Submit bot again executes submit switch case. And gives all the values which we edit or entered.

But when we moved to second iteration,
forms opens and when i click on editProcess bot came out of form activity and executes next activity instead of executing the do block and form remains open and when i click on continue it again go for next iteration and same process follow like 2nd iteration with another form opens. so at the end all forms remains open till bot stops.

many questions to be asked. But can you share the xaml? that would be quick.

Let’s avoid long posts and focus on quicker solution

Sorry xaml contains Company data so cant share the xaml .

The problem is I am not getting output when I loop form. I am getting result for 1st Iteration only. After 1st iteration I am getting null values in output of form activity.

What are you trying to achieve?

You can have a do while loop and place the form designer sequence inside the loop if you want to run the form in loop.

You can explain why you are opting for this. We do have real-time sync with form already for form.

Why anyone will submit multiple forms. If you want multiple data, you can create pages, tab and that eill do the needful.

I think some time ago I went into the same issue and I solved it using the flowchart and flow conditions. Not sure if it is a bug or something.

I think @sangL might take a look at this.

Hi @Pablito ,

Thanks for the reply.
I made changes as you suggested flowchart. Now the problem is data is not populated in Form when it clicks on button as we kept them outside do block. It keeps loading when I click on editProcess or editSubProcess and when i close form then it moves to switch case. Where it captures button as editProcess and then reopen form as per new changes now.
As per requirement it will appear dropdown to select process name. It was working fine
when i use switch in do block.

Is it right?


Not sure if I got you right, but eventually you may try to operate as you were but using the “closeOnSubmit” parameter for your buttons with the “false” value. I made a simple example that you may use to see how it works. Hopefully, this is something you are looking for.
FormsExample.zip (66.0 KB)

1 Like

Hey @Pablito

This is basically real time working with forms, that works well, but I see in @ImPratham45 's screenshot he is even checking submit button condition and have a do while. I do not understand why we need to submit the form and have loop inside it when we can change and perform real time action in forms

@ImPratham45 → If by any chance you want the form to stay as it is and you want to perform actions corresponding to button, do not use the loop inside the Form container, just use the click as action, for button and have only one button with “Submit” as action. once you click all the buttons, you can submit at once.

In case you want to have the entire form in loop then use a do while and then place the form container in it. Else, let us know the requirements

Below doc would show you some light.

Hi @Pablito ,

Thanks for the response. I checked your workflow. My Form is working fine if i ran it in single time. But when I run it i loop it is working successfully/correctly for first iteration only. I have attached sample please check and correct.

BlankProcess.zip (4.1 KB)

Here i create an array of names. Then loop it using for each.
In form i gave an option for edit name if name is wrong. IF wrong then we will click on edit and then new field will be appear. We will then enter new value in it and then press submit button.

This process is working for first iteration only. when bot running second iteration, when i click on edit forms moves to next activity instead of giving new name text field.

Thanks again for the help.



I am doing the same thing i.e. Real time change. But i want this form to execute in loop. Means for Transaction 1 it will pop up this form to user and then user will submit this form after modifications if any. Then bot will update data in database and perform their existing process for Transaction 1. Now same process will be followed for remaining transactions. So that is why I have put this Form ACTIVITY inside For each


Thanks brother for sharing the workflow finally. Had a quick look at your workflow, firstly that is not something which we can refer to as realtime sync because you are having multiple submit buttons.
In the button settings, select the Action as click, if you use that then the click button will be sent to the do block and corresponding condition will be executed.

I do see the result is not getting generated in the second iteration nor the do statement in form is getting executed. This stil seems to be an issue. Will give a try once later and update you.

“UiPath.OutOfProcessUi.Host.WCF” this is the service that is responsible for the UiPath form, and I tracked this in the windows shell, it seems to be running fine in both iteration

But this

inn your actual process will the above stage ill take a lot of time?

If yes, then you should go for this
If not, then you can use the Real time sync. Do not use the submit as action in button after you enter the data
Just take it as stage1 processing button, and for this click in Do block, perform the above quotes operation.

This is depend on the data we provide in form and accuracy of data. If it contains all data then user will just submit the form if there are false data then user will enable those fields and update new data.

Can you be more clear about

Real time sync. Do not use the submit as action in button after you enter the data
Just take it as stage1 processing button, and for this click in Do block, perform the above quotes operation

Here i want submit button as submit only. Remaining are to enable other text boxes or other elements. When user filled all the data then data will be stored to DB on submit.
So other edit buttons are used to enable other fields so user can add those fields too.

sure mate!
we’ll have a quick connect on zoom to clear that part.

I’m sure that would be of some help to you.

1 Like

I tried messing around with this to understand the cause of this error

It seems we can not use a same form in one workflow. I tried having the same form one after the other(screenshot below), in the second form below, the data was prefilled and the after submitting the output json was blank. I even changed the output variable name, reset the values of all variables before reaching second form but behavior was same.

I created a different form below and it worked normally.

Can we check if it is a bug or something needs to be learnt by us? @Pablito

Yes thats what i was trying to say.

I tried to change values after each run , also the button values but still didnt worked.

Hmmm, that might be a potential bug then.
@sangL - could you please take a look at it?