Yuck. This is a tough one - we use our own InfoPath Forms Services replacement, FormsViewer, which allows us to change submit connection URLs, so we can dynamically set those based on where the file is opened. But without third party tools, I don't see a way to do this. You are right that you don't want 100 (or so) submit data connections, then the 100 or so rules to determine which to use. What version of SharePoint are you using? On-prem or online? I don't think there is going to be a way to do this with JavaScript unless the form is displayed in a web part.... And InfoPath out of the box will only perform Get operations with REST, so I don't think you'll be able to save the file via one of SharePoint's web services.... But I wonder - won't the workflow let you overwrite an existing file? Or couldn't it be changed to first check and see if a file already exists with the same name, delete it, and then replace it? I don't use SharePoint Designer Workflow much, so I'm not sure what the options are.
Hilary Stoupa
