Document Id

Hello Everyone,

I've a requirement where

In step 1 User will upload a document from Form-1 

In step 2 User can download the document which was uploaded in step 1 and can re-upload it after editing from Form-2, the only condition is  Document Id should remain as it is.

 

i.e Document_Id in step 1 is : 123456 so if user edits and then re-upload the document then Document_Id shouldn't change.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Rahul Gundu (rahulg262)  is correct.

    this is documented: here.

    The complete detail for the target parameter states:

    [Target] Determines the eventual location of the uploaded file. When a Folder, the uploaded file is created as a document in that folder. When a Document, the uploaded file is created as a new version of that document.

  • Thanks Rahul.

    I have used the folder constant in the first form to upload the document and same i was using second form also due to which every time it was generating a new id for the document.
    Now i have used the document id (obtained from the first form) as target in the second form and its working fine.
  • Hi Rahul,

    The above method is working fine if i am uploading a single file, but when i am uploading multiple file then its is asking to have target value to max 1 else if I am using the folder constant then its again creating documents with different Id.

    Kindly suggest.
  • In fileUploadField component Target will be either document or folder (It won't accept Array value). When you provide document for 'target' property, component expects only one document to create a new version of a document.
    If you have multiple documents to replace, you can use looping function, which will generate multiple fileUploadComponents, you can replace one at a time.
    Please try below sample code.

    {
    a!richTextDisplayField(
    labelPosition: "COLLAPSED",
    value: a!richTextItem(
    text: "Replace Documents",
    style: "STRONG"
    )
    ),
    a!forEach(
    items: ri!doc_documentsFromFolder,
    expression: {
    a!fileUploadField(
    labelPosition: "COLLAPSED",
    maxSelections: 1,
    target: fv!item,
    value: fv!item,
    saveInto: fv!item
    )
    }
    )
    }