IPA flow to delete workunits

Sort:
You are not authorized to post a reply.
Author
Messages
Jessica M
Advanced Member
Posts: 34
Advanced Member

    We are having an issue with the size of our pfiactivityvariables table.  Info support has suggested scheduling a flow to delete anything older than 90 days.

    I have been playing with the various actions in IPA (test) and I'm not getting the criteria correct.    For now, I would like to delete flows completed in a certain date range.  I tried using "DeleteWorkunits" and "DeleteWorkunitsByDateRange" but I am not seeing anything come out of the workunits view in the rich client.

    Has anyone created a flow to do this?  If so, any pointers or suggestions?

    Thanks,

    Jessica

    Tim Cochrane
    Veteran Member
    Posts: 154
    Veteran Member
      Can you paste your LM node code so we can see it??
      Tim Cochrane - Principal LM/IPA Consultant
      Jessica M
      Advanced Member
      Posts: 34
      Advanced Member
        I didn't actually save it, as I just played around with different criteria. I will re-create and copy the code and the results.
        Jessica M
        Advanced Member
        Posts: 34
        Advanced Member
          I tried to delete by workunit number (workunit 1). It doesn't give an error, but the workunit is still there when I look at workunits in the Client and the table on the server.
          _dataArea="ltm" & _module="pfi" & _objectName="PfiWorkunit" & _actionName="DeleteWorkunits" & _actionOperator="NONE" & _actionType="CreateUpdateDelete" & _runAsUser="" & _pageSize="30" & _relationName="" & _setName="" & _asOfDate="" & _effectiveDate="" & PfiWorkunit="1"

          Log:
          ============================================
          Started locally: Jul 27, 2015 2:47:16 PM EDT

          Process started: PFMaintenance (Run id = 1) - 07/27/2015 14:47:17

          Activity started: Start (Run Id: 1)
          Executing Start Activity...
          Variables in Process:

          Activity completed: Start

          Activity started: LMTxn9380 (Run Id: 1)
          Landmark:LMTxn9380 Executing transaction_dataArea="ltm" & _module="pfi" & _objectName="PfiWorkunit" & _actionName="DeleteWorkunits" & _actionOperator="NONE" & _actionType="CreateUpdateDelete" & _runAsUser="" & _pageSize="30" & _relationName="" & _setName="" & _asOfDate="" & _effectiveDate="" & PfiWorkunit="1"
          Landmark:LMTxn9380 Executing transaction_dataArea="ltm" & _module="pfi" & _objectName="PfiWorkunit" & _actionName="DeleteWorkunits" & _actionOperator="NONE" & _actionType="CreateUpdateDelete" & _runAsUser="" & _pageSize="30" & _relationName="" & _setName="" & _asOfDate="" & _effectiveDate="" & PfiWorkunit="1"
          Landmark:LMTxn9380 transaction complete:true,
          response messageelete Workunits Batch... Submitted,
          record count:1,
          results header string: PfiWorkunit,
          results string:1,
          has next:false,
          has prev:false
          LMTxn9380_complete = true
          LMTxn9380_recordCount = 1
          LMTxn9380_hasNext = false
          LMTxn9380_hasPrevious = false
          LMTxn9380_resultsHeader = PfiWorkunit
          Landmark:LMTxn9380 Page 1 retrieved
          LMTxn9380_recordCount = 1
          Activity completed: LMTxn9380
          LMTxn9380_errorCode = 0
          LMTxn9380_informationCode = 0
          LMTxn9380_returnMessage = Delete Workunits Batch... Submitted
          LMTxn9380_outputData = 1
          LandmarkLMTxn9380: Executing loop 1 of 1 (Page 1)

          Activity started: LMTxn9380 (Run Id: 1)
          LMTxn9380_PfiWorkunit = 1

          Activity started: End-LMTxn9380 (Run Id: 0)

          Activity started: End (Run Id: 1)
          Activity End: Executing End activity
          End_errorCode = 0
          End_informationCode = 0
          End_returnMessage =
          End_outputData =
          Activity completed: End
          Process completed - 07/27/2015 14:47:18

          Process ran successfully
          Information code: 0
          Return message:
          Output data: (null)

          Finished: Jul 27, 2015 2:47:18 PM EDT
          Tim Cochrane
          Veteran Member
          Posts: 154
          Veteran Member
            Change your "_actionName" var to be "Delete", and not "DeleteWorkunits", as you're only deleting a single workunit. Here is my query, which worked 2-3 times when I tested it.
            Also - you can only delete Completed or Cancelled statuses, so may have to change status before you delete.


            _dataArea="test" & _module="pfi" & _objectName="PfiWorkunit" & _actionName="Delete" & _actionOperator="NONE" & _actionType="CreateUpdateDelete" & _runAsUser="" & _pageSize="30" & _relationName="" & _setName="" & _asOfDate="" & _effectiveDate="" & PfiWorkunit="914"

            complete: true
            response message: Work Unit Deleted
            record count: 1
            has next: false
            has previous: false
            Results header string: PfiWorkunit
            Results string: 914

            Communications trace
            null


            Also - the "DeleteAllWorkunitsByWorkunitRange" worked...as long as they are in Complete or Cancelled status

            Deleting by Date Range

            Delete by date range is a slightly trickier, since it requires full 16 digit dates (CCYYMMDDHHMMSSHundreths). I used & BeginDate="2015071300000000" & EndDate="2015071323595999" to say delete everything for 07/13/2015, midnight to midnight, which deleted the 7 workuits I had in test which started/ended on 07/13. You should be able to modify the dates by "x" days to get a bigger spread.


            _dataArea="test" & _module="pfi" & _objectName="PfiWorkunit" & _actionName="DeleteWorkunitsByDateRange" & _actionOperator="NONE" & _actionType="CreateUpdateDelete" & _runAsUser="" & _pageSize="30" & _relationName="" & _setName="" & _asOfDate="" & _effectiveDate="" & BeginDate="2015071300000000" & EndDate="2015071323595999"


            complete: true
            response message: Delete Workunits By Date Range Submitted
            record count: 1
            has next: false
            has previous: false
            Results header string: BeginDate,EndDate
            Results string: 2015071300000000,2015071323595999

            Communications trace
            null
            Tim Cochrane - Principal LM/IPA Consultant
            John Henley
            Senior Member
            Posts: 3348
            Senior Member
              moved to process flow forum
              Thanks for using the LawsonGuru.com forums!
              John
              Jessica M
              Advanced Member
              Posts: 34
              Advanced Member
                Based on your info, I ended up using the query below and it works. Thank you so much for your assistance.

                _dataArea="ltm" & _module="pfi" & _objectName="PfiWorkunit" & _actionName="DeleteWorkunitsByDateRange" & _actionOperator="NONE" & _actionType="CreateUpdateDelete" & _runAsUser="" & _pageSize="30" & _relationName="" & _setName="" & _asOfDate="" & _effectiveDate="" & BeginDate="2014010100000000" & EndDate="2015010100000000"
                JeffR
                Advanced Member
                Posts: 22
                Advanced Member
                  If the flow is triggered from an S3 application or action it creates a work unit on S3 and another work unit on Landmark. Is your flow deleting both work units or is it leaving an orphaned record on the S3 server? Because the S3 work unit never changes to a complete status, I am not sure it they would purge.
                  Jessica M
                  Advanced Member
                  Posts: 34
                  Advanced Member
                    It is being triggered on the Landmark side.
                    Tim Cochrane
                    Veteran Member
                    Posts: 154
                    Veteran Member
                      This logic only deals with Landmark work units...it doesn't touch (purge, archive, etc) classic (BPM) work units.

                      Not sure why you consider the classic work unit as orphaned...it did it's job and has completed...there just isn't a "Tiggered in LPS and now completed" status to use.
                      There is no activity to worry about in the classic work unit, so no need to worry about that space. If you really needed to purge BPM work units, then you could have DBAs truncate the tables.
                      Tim Cochrane - Principal LM/IPA Consultant
                      You are not authorized to post a reply.