How to avoid deleting a document to finish a Process Model event

Certified Associate Developer

So when the user selects a particular interface, a document is generated and if the user selects the 'cancel' button then the document is deleted. There are cases where the document might get deleted through another form so if you try to select the cancel button, then an error message appears. Right now this is the idea for the process model but its not fixing the issue so please let me know if you see anything that might fix the issue. the 3PI exchange node generates the document, then the XOR node checks to see if the pv!download_doc is null or not and if it is, then move to the end event, if not then to delete the document and end the event.

I tried a few other options for the XOR node but this is basically as far as I know what to do?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    There are cases where the document might get deleted through another form

    How (and WHY) would a document being generated specifically for this process instance, be "deleted through another form"?  Is that REQUIRED?  Because yes, that is making things much harder than they should be.  If AT ALL possible, I'd just get rid of that part.

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    I am new to this project but from what it sounds like this is an edge case that only happens when:
    Admin 1: opens the first interface and idles on it
                            (The document is created when the interface is opened)
    Admin 2: opens another interface that shows all the documents
    Admin 2: deletes the document
    Admin 1: tries to cancel the initial document, and receives the error message

     So there isn't a way to just get rid of it unfortunately.

  • +1
    Certified Lead Developer
    in reply to nickk1385

    Yikes.

    Well, as long as you're working with an awareness of how it's not really a best practice set-up...

    The good workaround I can suggest is that you check the document ID prior to the delete document node, using the "is object exists" rule from the "Check Object Existence" plug-in.  I actually keep a designated expression rule that can handle checking a doc ID against being blank or zero or non-existent:

    IF it fails this check, you would just step around the Delete Document node altogether using an XOR gateway (you'd use the one already set up in your screenshot, just replace the "is blank" rule with something more comprehensive like i've shown you here).

  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    I also made myself a generalized Utility subprocess called something like "Safe Delete Document" which simply consumes a Doc ID, does this check, then deletes the document (or goes safely around the Delete node), so I don't have to build that clunky XOR pattern into all the process models where I need to use it.

Reply Children
No Data