Skip to main content
dinesha5713
October 24, 2024
Question

How to handle the error when passing the wrong document id to document function

  • October 24, 2024
  • 4 replies
  • 0 views



lets say im passing the id as 1 to 1000 range for example , as there is no document with that id it will show error right 

    4 replies

    October 24, 2024

    Hi [mention:30bb505c1ca4449ca754b36b7a8ed1d7:e9ed411860ed4f2ba0265705b8793d05] 

    Check first document is availed in Appian or not

    dinesha5713
    October 24, 2024

    Thank ypu [mention:72ffa644327e4fa197837686e1eca5d8:e9ed411860ed4f2ba0265705b8793d05] 
    Its working

    mikes0011
    Brainy
    October 24, 2024

    The "Check Object Existence" plug-in referenced in Baji's comment has been deprecated and removed from the App Market.  Notably, every time it's run (at least any time it checks an invalid doc ID, and maybe even times it checks a valid doc ID), it creates a LONG error message in the system log file, so this is a good reason to avoid it.

    Instead, use the Content Tools plug-in and use the "get content object details by ID" function, which safely returns an invalid message (but not an "error") when a nonexistent ID is passed in.  I always suggest creating a system-global "document existence checker" expression rule, which would look about like this:

    and(
      a!isNotNullOrEmpty(ri!doc),
      tointeger(ri!doc) > 0,
      
      /*isobjectexists("Document", ri!doc)*/
      /* replacing with the below as the plug-in used is archived, and any check on an invalid doc ID results in a beefy log entry */
      
      find(
        "Type: Document,",
        getcontentobjectdetailsbyid(ri!doc)
      ) > 0
    )

    dinesha5713
    October 24, 2024

    thank you [mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05]