External Files/Record sets

I have a form that should create an entity. The entity should have file1 and file2 attributes. I would like the user to click on an upload button to load file1. Then the user clicks on a second upload button to select file2. Then the user clicks on Create. Upon clicking on Create, this will invoke a process that needs to get file1 path and file2 path and use that as a parameter for another method. I tried to set up such entity but ran into problems with the FileDescriptor and also that the upload fails because it triggers the Init method immediately.
Then i thought about using the External files, upload my files there and create an association attribute in my entity. The problem is that record sets and external files can’t be referenced as Type. Or at least, I don’t see the option.
Is it possible for the form to display a file selection for a particular record set?
thank you.

1 Like

What do you mean by “form”? An editor screen or a BPM form?
What are you going to do with the paths to uploaded files?
What do you mean by “record sets”? Record sets in the Folders Panel?

Yes by form, I mean an editor screen.
simple example. I would like to create an entity where users can upload their DOS batch files. For example for entity JOB, there will be attributes NAME and BATCHFILE. In the Edit screen, the user will specify a name (FTP reports) and upload the batch file (from c:\batch\ftpfiles.bat).
Then the user can go to another screen and select which job he’d like to run. When the user selects “FTP Repors” and clicks create, in the postCommit() method, java will invoke ftpfiles.bat.
Does it make sense?

So the server will execute files uploaded by users?
First, I would recommend simplifying implementation by saving text files right in the entity attributes. When creating such attribute, leave Length field empty and Studio will create a database field of unlimited length.
In uploadSucceded() method, instead of calling FileUploadingAPI.putFileIntoStorage() and saving FileDescriptor, invoke fileUploading.getFile() to get the File object for temporary file loaded by the FileUploadField. Read this file into memory and save its contents to the entity attribute.
When you need to run a script, just load the entity and save the script as a file.

with your solution, it works like a charm. Thank you.