File Picker Dialog

I actually kind of figured that this would have been asked a few times, but my search attempt wasn't all that successful. The only somewhat related topic was Script to Select File, but the script I found here only displayed server-side files since it required the use of oScript and couldn't be run on the client.

So here's what we know: Sage does have a built-in file picker that's capable of displaying network & local files (Example would be the  Associated PDF File Picker or the "Find File" picker used when adding an attachment to a memo). But I am not sure if these or a similar dialog is available for scripting or not.

Here's what I am wanting to accomplish via a button script (in various modules):

  • User clicks button, which displays an open-file dialog box
  • User selects a file, which could either be a local file or a server file (server would not be the same one as the Sage installation).
  • Dialog box returns the path of the selected file to the script, which then renames & copies the file to a server location under a structured folder setup.
    • For example, if the user was in AP Invoice Entry, the file would be copied to \\Server\Documents\SupportingDocs\AP-VendorDocs\<VendorNo>\Invoices\<InvoiceNo>.pdf
  • The file location could either be saved to a UDF or not saved at all - due to the structured folder setup when someone would click to open the supporting documentation all that script would need to do is check to see if a file is stored in its structured path or not because the script would already know the customer and invoice numbers and would just check ..\<VendorNo>\Invoices\<InvoiceNo>.pdf.

This doesn't even have to be a Sage-specific solution. I know that Internet Explorer was a popular method of displaying an open-file dialog box - but I can't use that because it's been depreciated and is no longer installed on any of our workstations due to the security risks of using unpatched software. If there's a way to accomplish this using commonly installed libraries (without IE) that would generally be available on workstations using CreateObject() I am open to those suggestions as well.

The major benefits of this is that a user doesn't need to know the path to save the document. Also, the file could be kept locally to that user and it wouldn't matter since the script is saving a copy of it ---- I've seen memos created by less tech-savvy people with a file "attachment" that has a path starting with C:\ (obviously not a server path) - which means everyone other than that user doesn't have access to it.