7 Replies Latest reply: Feb 7, 2013 10:33 AM by Bunty RSS

    Workflow: delete content item after exit

    Bunty
      I am using criteria workflows and in one of the steps, if the Action is Reject, content is exiting the workflow (wfExit). At this point, the document is Released and is visible to users with access to it. Is it possible to delete the document before it is published, without any human intervention?
        • 1. Re: Workflow: delete content item after exit
          Jonathan Hult
          Do you truly want to delete the content or just archive it out of the system? The latter would allow for recovery of documents.

          You should be able to use the workflow exit event, check if the action was reject, and then run a service (using the Idoc Script executeService function) to delete or archive the document.

          This list the services you have available: http://docs.oracle.com/cd/E28389_01/doc.1111/e11011/c04_core.htm

          Jonathan
          http://jonathanhult.com
          • 2. Re: Workflow: delete content item after exit
            Bunty
            Is Archive = Expire content?

            Is there a delete service that is scriptable or do I need to make DELETE_REV scriptable?

            Should the executeService be placed in last step of the workflow exit script or can I use it in entry script of previous steps?
            • 3. Re: Workflow: delete content item after exit
              Jonathan Hult
              Archive does not necessarily mean expire. You could expire content, or you could export content (using Archiver) and then delete it.

              I would look in Component Wizard and see if you can find a delete service that is scriptable (so it can be called from Idoc Script). If there is not one, you would need either override one (and set it to scriptable) or create a new service.

              You can put the executeService wherever you know the workflow has been rejected (whether in an event or a step it should not matter).

              Jonathan
              http://jonathanhult.com
              • 4. Re: Workflow: delete content item after exit
                Bunty
                I will update how it goes.
                Thanks!

                one more question...
                consider a workflow with 3 steps and 3 approvers.

                step1 - approver 1 - can create new revision - executeService script in entry step
                step2 - approver 2 - review
                step3 - approver 3 - review

                if the document is rejected in step2 or step3 it goes to step 1, now the executeService will run under approver 1 context or the approver who rejected it?

                Edited by: Bunty on Feb 6, 2013 2:25 PM

                Edited by: Bunty on Feb 6, 2013 2:28 PM
                • 5. Re: Workflow: delete content item after exit
                  Jonathan Hult
                  Why does it matter who the service runs as? Is it a permissions issue that one approver does not have the proper permissions to delete?

                  Jonathan
                  http://jonathanhult.com
                  • 6. Re: Workflow: delete content item after exit
                    Jiri.Machotka-Oracle
                    Guys, sorry to interrupt, but IMHO your discussion has one flaw: neither REJECT, not wfExit(100,100) can be caught in the Exit event (of the step where they happen).

                    As for REJECTs (to which workflow step it returns) see UCM 10G workflow reject issue or wfAction Reject is not working

                    As for wfExit(100, 100) I tried to following scenario:

                    Step 1 (Revision/Edit Current)
                    Entry:
                    <$trace("Step1 - Entry", "#log")$>
                    <$if wfAction like "REJECT"$>
                    <$wfExit(100,100)$>
                    <$endif$>
                    Exit:
                    <$trace("Step1 - Exit", "#log")$>
                    Step2 (Revision only)
                    Entry:
                    <$trace("Step2 - Entry", "#log")$>
                    Exit:
                    <$trace("Step2 - Exit", "#log")$>
                    Now, if you check-in an item, approve it on step1 and reject on step2, the log will contain:

                    Step1 - Entry
                    Step1 - Exit
                    Step2 - Entry
                    Step1 - Entry

                    IMHO, what you could try is to execute the delete in a filter hooked to advanceDocumentStateMarkWorkflowFinished, which is Executed just before a content item in workflow is marked as finished. You can perform additional logging, or update external resources with this filter.
                    • 7. Re: Workflow: delete content item after exit
                      Bunty
                      John, its a permission thing. Delete access is not given to anyone ... only Author (other than admins) can delete the document.

                      Thanks Jiri..

                      I figured, overriding the WORKFLOW_REJECT template page will be much simpler.
                      change the service to DELETE_REV instead of WORKFLOW_REJECT based on some conditions.