How can we upload documents using the upload widget in Bonita BPM 7.4.2 by binding it with a DB connector?
My use case is to allow the user to upload document(s) to a MongoDB server from the UI.
I have designed the form for this purpose but I am encountering few problems in configuring the DB Connector and have little to no idea how to bind the upload widget with the DB connector. Specifically, the upload widget has a property - URL that can be configured to tell where the data needs to go; I wish to know how I can specify this property if I have a configured DB Connector.
Thanks in advance!!
- If I am facilitating the upload of the documents via a script in the operations tab; I can do all tasks such as connecting to DB and actually uploading docs through. Do I still need a connector configuration?
No not really, but one thing we found very quickly was we wanted to use it again, and again, and again, and...I think you get the picture.
It is easy to think you will do this once when in-fact we use it at least 560 times. A subroutine was the only way to go.
- How does the information go back to the operations tab by clicking the Submit Button - does this need to be mentioned somewhere in the properties of the button?
How else would it get back? You should format the formOutput variable to send back the collection. In your table you will have ADD button to add a new document, this in-fact adds to the collection, it is the collection you will be sending back and then save to a variable which you can process via a Script Task calling the subroutine which calls the upload script.
- How can I give positive/ negative feedback to the user if the actual upload succeeded or not?
We don't do that, we only allow the Admin to sort that out as the file is uploaded on submit, how exactly we don't worry about it. We trust the system in this case. ;)
I'll be honest - just use a script connector, it's much easier to control and use.
And you'll know the code.
The UI will return the document as part of a contract - you then just have to access the document through the documentID from the output operation, from there it's quite easy to build the document as a byte stream and upload it to the database through a Insert command.
regards
Seán
regards
Seán
PS: As this reply offers an answer your question, and if you like it, please Mark UP and/or as Resolved.
Comments
All right, thank you for this. It seems easier than trying to configure a MongoDB Connector with the UI.
Please pardon my naivety, but I just need to confirm if I am doing the right thing to facilitate the upload of documents. So, I need to have a contract for the files being uploaded as well as one for the document ID (or documentName as well, optionally). My doubt is more inclined towards knowing this:
I made a simple form where a user can upload multiple documents by clicking the add button. So, when I click the paperclip button and choose a file for upload, where does the file get stored -- is it some local/temp folder on the server where the form is served? I assume, that this shall work only if I actually run the application and shall not work if I run in Preview mode(as I encountered an error stating "Upload failed" when I ran it in Preview Mode).
The script connector that you mentioned in the answer will be used to convert the file object to a byte stream and upload to the server -- is this understanding correct? Can I facilitate the triggering of this script on the action of a button?
Your help and guidance is greatly appreciated!!
Thanks
Thank you so much for taking the time to clarify my doubts regarding the entire process. This is really helpful
Though, I still have last couple of clarifications -
-
If I am facilitating the upload of the documents via a script in the operations tab; I can do all tasks such as connecting to DB and actually uploading docs through. Do I still need a connector configuration?
-
How does the information go back to the operations tab by clicking the Submit Button - does this need to be mentioned somewhere in the properties of the button?
-
How can I give positive/ negative feedback to the user if the actual upload succeeded or not?
Thanks a lot!
Comments
Thanks a lot, Sean! I think I am getting to understand the picture piece by piece so some rudimentary doubts keep coming up.
This is great help!!
That being said, I've just throw a quick something together and I'm also confused a little...
Will get back to you on this.
regards