HI. I'd say that your answer depends on your use case. Is a user on another layout every time before they access this layout, or will they see this layout on their screen and start using it when they have info to fill in.
For a 'clean up' kind of script, I'd always put it at the END of the process. IF you have a "Submit" button, I'd put it there. Why not wipe out the data when you're finished with it?
But you can always put it on the button that accesses this layout. If you have a script called "goToForm" that takes the user to this form, I'd run this clean up script at the very beginning. That way the user never sees old data in the form before its cleared out.
the user is always on another layout every time before they access this layout, but they have two buttons on the form a cancel and a submit form.
So I can clean in my buttons scripts, or use the "goToForm" script.
In fact in my case I think using the "GoToForm" script would be the best.
Do you agree with it?
It is reasonable to clean out the fields in the goToForm script. Make sure to do it before you actually go to that form layout. Since they're global fields, layout context is irrelevant. Clear them out. THen go to the layout. The user will be presented with a clean layout to add data.
I would still probably clear out the fields AFTER the data has been entered and they click either "Cancel" or "Submit". I like the idea of cleaning up the fields when the process is done. It is sort of like variable scope: when you're done with a global field, clear it out.
You could easily create another script that clears out the fields and then use the Perform Script [ ] script step inside your "cancel" or "submit" scripts. That's what I do.
Thanks for the info. Since I am a better safe than sorry kind of person I was cleaning every where I could. But I want to be sure it is not too time consuming for the process.