Hi,
Thank you for your query.
When you say you are not able to save the record, what happens? It does not save or it gives error?
And what is the default value of "saveFromConfirmDialog"? I see problem here.
Please note, when you save the record programmatically, the same function will be called again, you need to make sure SaveFromConfirmDialog is not reset to true.
You can add debugger; in top of this function, launch Dev Tools (F12) and debug the code line by line (F10) to verify if formContext.data.entity.save(); is called.
If it is not the problem, please provide more details.