@mariyadass49354 Once the form is flattened you won't be able to do any change on the form. You need to perform them at rendering time or using a script before flattening.
Can you please help me understand how you converted the XFA file to Flatten PDF. I have a similar situation where I have to save the PDF to show all hidden sections.