rencygonzalez
Novice

how to delete items based on scheduled workflow

Jump to solution

Hello,

I have two lists List A and List B

Users put in an item to delete request in List A and I go in and deleted the item that needs to get deleted in List B and also remove the request  from List A.

I created a workflow that will delete the item in List B based on the request made in List A however I want to schedule the workflow to run at midnight to delete all items automatically in both List A and B daily.

I am assuming I should be using start workflow action? If so how do I specify daily at midnight?

 

Thanks

Rency

0 Kudos
Reply
17 Replies
rencygonzalez
Novice

Re: how to delete items based on scheduled workflow

Jump to solution

scheduleworkflow.png
This is how I have it configured however I keep getting an error.

0 Kudos
Reply
xMikeX
Scholar

Re: how to delete items based on scheduled workflow

Jump to solution

Hi Rency,

Why not create a Site workflow and use the scheduler to accomplish this.  In 2013 : click the Gear > Nintex Workflow 2013 > Schedule site workflows

Inside of your site workflow, use two delete multiple item actions pointing to their respective lists.

Thanks

0 Kudos
Reply
rencygonzalez
Novice

Re: how to delete items based on scheduled workflow

Jump to solution

Hi

Thank you for the reply. I started building out my site workflow however when I reference List A by using the delete multiple items function I click on insert reference option and unable to choose the ItemID. I don't see an ItemProperties option since it is being built on the entire site.

The filter should be ItemID is equal to ItemID. I was able to set that up when the workflow was list level.

reference.JPG

0 Kudos
Reply
xMikeX
Scholar

Re: how to delete items based on scheduled workflow

Jump to solution

Hi Rency,

I thought you wanted a workflow that would run on a schedule to clear out List A and List B entirely - separate from the one that was launched on List A to target specific List B items.

Is this true?

OR  Do you want a workflow that runs on the schedule that looks at items in List A and then based on that deletes the items in List B (as well as the associated item in List A)?

Thanks

0 Kudos
Reply
murphybp2
Scholar

Re: how to delete items based on scheduled workflow

Jump to solution

When doing a site level workflow, you'd need to add an extra step of querying the list first to get the item ID, and storing that in a variable.  Then you can add that variable in your filter. 

View solution in original post

0 Kudos
Reply
xMikeX
Scholar

Re: how to delete items based on scheduled workflow

Jump to solution

If it is the "OR" option then:

Use Query List action to get all the ID's that link List A to List B and store them in a collection.   You could then loop through this collection with a  foreach, and delete each item from List B where the current ID is matched.   Once you are done clearing out List B, you could then go ahead an clear out List A by deleting all items using the delete multiple items action without a filter.

This way you'd still have the items in List B that did not have a request in List A when this process fired.

0 Kudos
Reply
rencygonzalez
Novice

Re: how to delete items based on scheduled workflow

Jump to solution

Hi,

Thank you for the reply.

I am sorry I should've written it in more detail. List A has a column called ItemId. List A is where users request items to get deleted in ListB.

This same column ItemId exists in List B.

In list A I have a workflow created and a delete Item action that is set to delete based on the ItemID column. This is saved in a collection variable and I am using the ForEach loop, then I have this variable referencing List B ItemID column and deleting the item in List B. That piece work beautifully.

The issue is, I want the workflow to start at midnight everyday.

So if the user creates a request in List A, then the workflow only deletes the item at 12am.

I hope that makes sense.

0 Kudos
Reply
rencygonzalez
Novice

Re: how to delete items based on scheduled workflow

Jump to solution

pause until.JPG

Will this work? Does the date automatically change per day? Or do I have to go into the workflow and change it daily?

0 Kudos
Reply
xMikeX
Scholar

Re: how to delete items based on scheduled workflow

Jump to solution

No problem, - Sounds like you are doing pretty close to what I described above.  I would move this out to a site workflow and schedule it there.  Use the Query List action to get all IDs needed in List A.  Loop through collection to delete in List B.  When done, delete all from List A.

Pause Until will not be dynamic - you'd have to change it each time, or use a variable instead of a selected date.  I'd recommend the approach above.

0 Kudos
Reply