Dynamic Document Generator, DOCX to PDF, PDF not updating with DOCX

Certified Associate Developer

We are using the Dynamic Document Generator plug-in to convert a DOCX file created from a template to a PDF. The word document creation works perfectly, however the PDF seems to be static and does not update based on the new values in the word document. Both the word document and the PDF are set up to overwrite the existing files each time.

Does anyone have any ideas on what could be causing this and how we could fix it?

Thanks.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    I'm not completely sure, but I suspect this might have to do with the fact that some smart services seem to (inadvertently, I assume) ignore new versions of a file, instead only looking at the originally published version.  To combat this I have an expression rule in my system which takes a document ID (corresponding to the original doc ID and the one you'd see when checking from the front-end) and returns actual back-end ID of the most recent version.

    todocument(
      tointeger(
        index(
          findcontentbyattribute(
            searchAllContent: false(),
            contentType: "document",
            attributeName: "name",
            searchCriteria: document(ri!document, "name"),
            rootFolder: rule!RULE_replaceNull(
              ri!rootFolder,
              document(ri!document, "folderId")
            )
          ),
          1,
          null()
        )
      )
    )

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    Hey Mike, that sounds like exactly the problem we're having. Could you give me some more clarification on how to implement that expression rule. Specifically, where to implement it in the process and what the RULE_replaceNull expression rule contains? I'm assuming the "ri!document" variable is the document number and "ri!rootFolder" is the folder the document is located in.

  • 0
    Certified Lead Developer
    in reply to Jack Ferguson

    the "replacenull" rule basically just encapsulates and simplifies your common if(isnull(X), Y, X) logic (in SQL it's the "IFNULL()" function, for example) - i find it very handy to have as a general/global expression function in my environments.

    The rule logic i've provided here can be used when feeding the Source Document ID to the in-process smart service node.  When fed a valid document ID as an input it should always return a valid output (just the original doc id when there aren't any added revisions).  I think the "root folder" rule input could just be omitted, but this is essentially how I found it and I haven't toyed with it to check.

Reply
  • 0
    Certified Lead Developer
    in reply to Jack Ferguson

    the "replacenull" rule basically just encapsulates and simplifies your common if(isnull(X), Y, X) logic (in SQL it's the "IFNULL()" function, for example) - i find it very handy to have as a general/global expression function in my environments.

    The rule logic i've provided here can be used when feeding the Source Document ID to the in-process smart service node.  When fed a valid document ID as an input it should always return a valid output (just the original doc id when there aren't any added revisions).  I think the "root folder" rule input could just be omitted, but this is essentially how I found it and I haven't toyed with it to check.

Children