cancel
Showing results for 
Search instead for 
Did you mean: 
ksmith2011
Nintex Newbie

Move items to archive list, after date on item is so many days old

Hello, 

 

I'm new here to Nintex and have searched several other posts that are similar to what I am looking for, but can't get my workflow to execute correctly. I'm needing a workflow to run daily that will look at the date field (date the item was scheduled) for all items, and then move any items that are over 395 days old from the scheduled date, to an archive list. I've attempted to calculate a date using, date when action is executed -395, and saving to a date/time variable. Then, query my list for when the scheduled date is less than my variable date. But, when running/executing the query no results are populating. Please help!    

Labels: (1)
0 Kudos
Reply
2 Replies
Highlighted
Carewen
Nintex Newbie

Re: Move items to archive list, after date on item is so many days old

I'm going to start with some development assumptions:

  • You've used "Log to history list" action to expose the values stored in variables.
    • This will allow you to verify that you've got the right information to trigger the event you're looking for
  • I've not had much luck with site workflows, but this might be more suitable than as a list workflow:
    • If you go with a site workflow then you can schedule this each day
    • If you go with an item workflow, restart this within the workflow (see comment below)

 

From a development point of view the essence of the logic that jumps out to me is:

  • Calculate Date: {Current Date} + 395
    • Use Log in History to validate that you're showing the correct date
  • Query the target list to populate all IDs into a collection variable
    • This is OK so long as you're not dealing with a massive list.
    • However, given the archival strategy you'll likely be good.
  • Inside a For Each Loop (using the collection variable just created):
    • Read each list item for it's Created date, comparing to your Calculated date
    • Set a Condition
      • If Created > Calculated Date
        • Copy the item over to the archive list
        • Delete the item
    • Keep calm and carry on Smiley Happy

 

If you opt for an item level workflow approach:

  • The challenge here is that the Created field is a system field, so you can't manipulate it
  • Option 1:
    • Begin this with a Loop, with a Pause for 1 day action at the end
    • The risk with this approach is that at some point the workflow would want to archive the item it's running on. 
      • Include a check to ensure that you Start (this) Workflow on the item last added. 
  • Option 2:
    • Collection operation to Count the number of items in the list
    • Use nIndex inside the For Each loop to grab to execute this on the latest created item
    • Inside the For Each loop Start (this) workflow on the last item
    • Pause For a day
    • This approach would remove the need for a (while) Loop. You'd effectively hop to the last created item in the list and be running this workflow one time on it.
    • Oh, and I'd add a check so that it doesn't delete the item it's running on. This would could be solved by checking for this item's ID and using Run If (this sID not equal to sCurrentLoopID)
  • There are a few risks with this. Ideally though you'll pull this off as a Site Workflow, which can be scheduled each day. 
0 Kudos
Reply
ksmith2011
Nintex Newbie

Re: Move items to archive list, after date on item is so many days old

Hi, Carewen. Thank you for the response!

 

I believe I have everything set up as you described below, with the exception of the calculate date action. I'm working with a list that is already being utilized and already has items entered. So, my calcuated date is: current date (or date when action is executed - 395). With that being said, I'm still getting the following error: 

 
Coercion Failed: Unable to transform the input lookup data into the requested type.
0 Kudos
Reply