After adding the attachment field to employee form and made this field mandatory I faced the following issue when try to attach the file.
Save Document before attach a file.You can attach file only after saving the document
I assigned this field as mandatory. how can I save the document without attache file???.
As far as I know there is no way to do this easily.
When the document is saved it’s written to the database, and until it’s written to the database an attachment has nothing to reference. So you can’t have an attachment field marked as mandatory.
A possible workaround could be a script that would attach the file to a different database entry initially and then switch it to the new one once saved.
Possibly you could make the document submittable, and allow to submit only if there is an attachment (validate using code)