NOTE: PLEASE SEE MY LATEST UPDATES ON MY ISSUE ON THE COMMENT SECTION.
Hi every one, not sure if you have experienced this before:
The given requirement is to create an interface with a file upload field. With that file,check if the file format is csv, and if all the columns's header name are the right name and are in the right order).
My code is attached below. The issue is that when the basic user's account is given viewer permission in my document folder, the file was not uploaded succesfully to the folder. If you have any recommendation please reach out. Thank you
a!localVariables( local!document, local!uploadSuccess, local!correctFileFormat, a!fileUploadField( label: "File", target: cons!INCOMMing_DOCUMENTS, maxSelections: 1, value: local!document, saveInto: { a!save(local!uploadSuccess, false), local!document, if( a!isNullOrEmpty(local!document), {}, a!submitUploadedFiles( onSuccess: { a!save(local!uploadSuccess, true), a!save( local!correctFileFormat, a!localVariables( local!validCSV: difference( upper(document(ri!uploadFile, "extension")), "CSV" ) < 0, if( local!validCSV, a!localVariables( local!extractFile: previewcsvforimport( document: ri!uploadFile, delimiter: ",", charset: "UTF-8", numberOfRows: 6 ).data, local!nullFile: a!isNullOrEmpty(local!extractFile), local!previewFile: if( local!nullFile = true, null, local!extractFile[1] ), and( local!nullFile = false, exact( stripwith(upper(local!previewFile[1]), "/ (),."), upper( stripwith("File Name / Message ID", "/ (),.") ) ), exact( stripwith(upper(local!previewFile[2]), "/ (),."), upper(stripwith("Service", "/ (),.")) ), exact( stripwith(upper(local!previewFile[3]), "/ (),."), upper(stripwith("Type", "/ (),.")) ), exact( stripwith(upper(local!previewFile[4]), "/ (),."), upper(stripwith("Date Received", "/ (),.")) ), exact( stripwith(upper(local!previewFile[5]), "/ (),."), upper(stripwith("Status", "/ (),.")) ) ) ), false ) ) ) }, onError: a!save(local!uploadSuccess, false), documents: local!document ) ) }, required: true(), validations: a!localVariables( local!invalidExtensions: difference(upper(fv!files.extension), "CSV"), if( length(local!invalidExtensions) > 0, "Attachments must be csv files. Please remove: " & index(fv!files, "name", {}), if( and( a!isNotNullOrEmpty(local!document), local!correctFileFormat = false ), "Please upload a file following required format", "" ) ) ) ) )
Discussion posts and replies are publicly visible
I think the upload document action is having issue, I just rechecked. I created a page (interface) with the attached code above. Then when I use my basic user account to upload the file, I got local!uploadSuccess = false (local variable to check if the file has been uploaded successfully to appian folder - I can verify this by adding a richtext display section right under my quickUploadFile()).
I had added this basic user to the application all user group, which has viewer permission to the document folder. I'm I setting the security permission wrongly?
Update: File uploaded and be validated successfully if I give the basic user account administrator permission in my document folder. But is this the right action? because I don't want to allow basic users changing anything in my document folder.
You need to give basic user "Editor" permission for that folder not admin permission.
mollyn126 said:because I don't want to allow basic users changing anything in my document folder.
Just giving them editor permission for a folder (which as others have pointed out, is needed for them to be able to use the file upload field), doesn't automatically allow them to "change" things there. Mainly this is because they have no access to the back end and therefore would have no method by which to access the folder properties to edit them, like someone with /design access would have.
Make sense, thank you!