Document Name Storing with document name, extension and size instead of only document name.


I am validating just uploaded document size  with below code:


fullName: null(),
name: null(),
ext: null(),
size: tointeger(null())


local!value: a!fileUploadField(value: todocument(ri!documentId), target:cons!RMO_FOLDER_ALL_DOCUMENTS, fileNames: fv!file),

local!fileDetails: tostring(local!value.contents.value.filename),

local!fileName: extract(local!fileDetails, "[name=", ", extension" )[1],
local!fileExt: extract(local!fileDetails, "extension=", ", size")[1],
local!fileSize: tointeger(extract(local!fileDetails, "size=", "]")[1]),
fullName: local!fileName & if(rule!APN_isBlank(local!fileExt), "", "." & local!fileExt),
name: local!fileName,
ext: local!fileExt,
size: local!fileSize

Issue: After clicking on submitting button, document name storing as [name=Document Name, extension=docx, size=3752844] instead of only document name in KC.

Can anyone let me know how to store only document name instead of all above details in KC.

  Discussion posts and replies are publicly visible

Parents Reply
  • We are having multiple tabs and uploading documents for each tab.

    You kinda buried the lede on this one - this sort of detail is something that could be mentioned up-front, IMHO, so we don't have to chase our tails to arrive at how the default configuration fails to satisfy your use case.

    In general I have to suggest you reconsider this design approach.  As we're seeing currently, there's no standard-and-supported way of directly accomplishing this without implementing weird / strong / unsupported work-arounds.

    FYI, I do have an outstanding Feature Request thread asking for access to the file properties within the SaveInto parameter of the file upload field.  Using this (hypothetical) functionality, we could have file upload components assemble an array of uploaded document filesizes, and use that to throw a form-level validation on your interface when the user attempts to submit.  I certainly wouldn't mind if you go over there, join on, and add some commentary to float it back to the Community front page and back into peoples' attention ;-)

    For now...  The best I can suggest at this point is to either move all document uploads to one particular tab where validation can occur before submitting, or off to a different task completely.  Or, (and this might be best) disable tab-changing outright when any new files are present, until the user clicks a "validate files" button, which submits the form and loops straight back to the task (at the current tab) - giving you an effective way of enforcing failed validations.  If set-up properly this could be seamless to the end user, and requires only minor additional tweaks in the form and process.

    Now... In the past I've definitely used your trick of using a FileUploadField pointing to the newly-uploaded file and digging into the back-end details to get information -- but as you're seeing here, it's tricky to do and has unpredictable side-effects, and as it's unsupported usage, it's liable to change (or go away altogether) at any time with no notice.

No Data