Skip to main content
April 19, 2024
Solved

Document exists or not

  • April 19, 2024
  • 5 replies
  • 0 views

I have a list of Ids I need to check wheather document is exists or not - isobjectexist function is not availble in the community is there any alternate function please help me

    Best answer by stefanhelzle0001

    I design my apps in a way that I never get into such a situation. I store the document ID + some meta data into a database table. If I delete a document, I delete that row in the DB & the document.

    5 replies

    karumurua531442
    April 19, 2024

    Hi [mention:e1f38339f5254c84af299fc34f8b6f1c:e9ed411860ed4f2ba0265705b8793d05]  you can try getcontentobjectdetailsbyid() this function.when you pass id into it , it would return all the context of it else it would retrun No object with this ID has been found"

    April 19, 2024

    issue with this getcontentobjectdetailsbyid() -  Scenario - document is not there with id but we may have other object with the same id we will get that context right

    harshk1671
    April 19, 2024

    You can use the result of getcontentobjectdetailsbyid() to todocument() function to check whether the object is document or not.

    stefanhelzle0001
    April 19, 2024

    I design my apps in a way that I never get into such a situation. I store the document ID + some meta data into a database table. If I delete a document, I delete that row in the DB & the document.

    New Participant
    April 19, 2024

    Hi [mention:e1f38339f5254c84af299fc34f8b6f1c:e9ed411860ed4f2ba0265705b8793d05] , isobjectexist is a plugin it will be available only when you deploy in Community. FYI, In Admin console just go through Plug-ins and click on add new plug-in, then search with Check Object Existence , deploy it. Now you will able to access that plugin in community.

    If you are able to see that plugin, try like below it will solve ur problem.

    reject(

    a!isNullOrEmpty(_),
    a!forEach(
    items: ri!Documents,
    expression: if(
    isobjectexists(
    typeOfObject: "Document",
    objectId: fv!item
    ),
    fv!item,
    null
    )
    )
    )