Skip to main content
Known Participant
Apr 19, 2024 10:35 AM UTC
Solved

Document exists or not

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

    stefanhelzle0001
    Brainy
    Apr 19, 2024 11:15 AM UTC

    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
    Participating Frequently
    Apr 19, 2024 11:05 AM UTC

    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"

    Known Participant
    Apr 19, 2024 12:48 PM UTC

    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
    Inspiring
    Apr 19, 2024 1:08 PM UTC

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

    stefanhelzle0001
    Brainy
    Apr 19, 2024 11:15 AM UTC

    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
    Apr 19, 2024 11:28 AM UTC

    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
    )
    )
    )