Can I save a document to a CDT?

Certified Lead Developer

We have a multiple CDT.
A couple of the fields in the CDT are of type Document.
When in a form, the user uploads a document via fileUploadField and the document is saved to the appropriate field of type document in the CDT.
Back in process the CDT is passed from the ri in the form to the ac in the user input node, and the ac is saved to the pv for that CDT.
But when the user submits the form and the CDT is saved to the db, the appian doc id is wrong (usually off by 1) and the document is lost.

Why can't I save a document to a CDT?

OriginalPostID-211221

OriginalPostID-211221

  Discussion posts and replies are publicly visible

Parents
  • I think this has been a behaviour/limitation of appian since I have started practising appian.
    When you upload a document in the form it is stored temporarily in the server and a temporary document id is created. When you submit the form it is stored in the targeted KC and document id is incremented.
    I would like to correct something in your post, there cannot be fields in a CDT which are of type Document.
    But I think you intend that there are some field that are of type integer and store the document id.

    For achieving your requirement there are some ways which i would like to share.
    You can have a buttonWidgetSubmit with name "Upload" and style "NORMAL" which upon clicking submits the form, goes into the process model (which helps the document getting upload into the targeted KC) and then comes back to the same form immediately through activity chaining.
    There should be a XOR gate which should check that the submit action was from the Upload button not from actual submit button.
    After the XOR check there should be a script task by which you can initialize the document id cdt field with the actual document id.
    Now as you have the actual document id you can convert it into a document and perform a variety of validations.

    Attaching some screenshot for your information.
    Hope the information was helpful.

    Upload Doc Form and process model.zip

Reply
  • I think this has been a behaviour/limitation of appian since I have started practising appian.
    When you upload a document in the form it is stored temporarily in the server and a temporary document id is created. When you submit the form it is stored in the targeted KC and document id is incremented.
    I would like to correct something in your post, there cannot be fields in a CDT which are of type Document.
    But I think you intend that there are some field that are of type integer and store the document id.

    For achieving your requirement there are some ways which i would like to share.
    You can have a buttonWidgetSubmit with name "Upload" and style "NORMAL" which upon clicking submits the form, goes into the process model (which helps the document getting upload into the targeted KC) and then comes back to the same form immediately through activity chaining.
    There should be a XOR gate which should check that the submit action was from the Upload button not from actual submit button.
    After the XOR check there should be a script task by which you can initialize the document id cdt field with the actual document id.
    Now as you have the actual document id you can convert it into a document and perform a variety of validations.

    Attaching some screenshot for your information.
    Hope the information was helpful.

    Upload Doc Form and process model.zip

Children
No Data