Latest document version not being captured

Certified Senior Developer

Having an issue with document related Plugins such as Copy Document and PDF from Docx(with fonts)

To test the scenario, I created and uploaded a docx file to appian called "WordDocument". In the body of the document, i input "Version #1"

I then uploaded a two addtional versions. The document had the same file name, but the body was changed to "Version #2" and "Version #3"

Using the Copy Document node in my process model, each time i run the process, it ignores the latest version of the document, and continues to copy version 1.

Note: We are using v1.2.0 of Content Tools

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Hey aakash- hope things are going well for y'all.

    I had a similar issue when dealing with a custom plug-in that generates an excel file - i noticed eventually that it always gets the original version of an uploaded template and disregards subsequent new versions.  I believe this is a bug in the plug-in in question, and it sounds from your description like Content Tools might have a similar issue.

    Luckily I stumbled on the following code snippet which uses a bit of a brute-force approach to look up the document id for the latest version of a file with multiple versions (i think in the Appian FS, the updated version is given its own unique id, but the original ID essentially becomes a pointer to the new ID, which helps explain why certain functionality misses this and still uses the original referenced document).

    We have this as a utility expression rule i.e. `RULE_Utility_getLatestDocumentVersion`, with an input for Document and an optional input for RootFolder (which i think can usually be omitted).

            searchAllContent: false(),
            contentType: "document",
            attributeName: "name",
            searchCriteria: document(ri!document, "name"),
            rootFolder: rule!RULE_General_replaceNull(
              document(ri!document, "folderId")

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Thanks mike! Worked like a charm.