Document saved in the way not i expected

Hi all,

I have a form with a action button “Save & Close” with the formula:

@Command([FileSave]);

@Command([FileCloseWindow]);

In the form , i have a hotspot button (Button 1). When user press the Button 1, it will run an agent, and the agent will perform some tasks and will set a field called “Generated” to “Yes” in this form. If Generated = “Yes”, then it will hide the Button 1 so that user can not press it anymore. Generated is a hidden editable field with null value.

So, the problem is, after running the agent, the user press “Save & Close”, and when i go back and check again, the Generated field is not set properly. But if user did not press the Save & Close, then it will set properly…I know it is the @command([FileSave]) which causes the problem, but i just dont know how to solve it. The “Save & Close” button is necessary in some situations so i cant disable it…

Any helps ? Thanks.

Part of the agent’s code:

curdoc.Generated = “Yes”;

call curdoc.Save(True,False);

Subject: Document saved in the way not i expected…

Abu,

It sounds like you are setting the back-end value and then the front-end is overwriting it.

Can you replace your curdoc.Generated=“Yes” with call uidoc.fieldsettext(“Generated”, “Yes”). Alternatively, after saving the curdoc, do a uidoc.reload to refresh the front-end document

HTH

Mike

Subject: RE: Document saved in the way not i expected…

Hi,

Thanks, it works now. Like what you said, the value has been overwritten. Thank you so much.