1

I`ve researched a lot, but cant find option that would allow to delete an item from SPS2013 list based on the closing date reaching Today date and workflow running all the time automatically. Imagine, data already feeded and now the execution go on based on closing date criteria.

Any suggestions

4

You can use Information Management Policies.

  1. Go to the list's advanced settings, and change allow mgmt of content types to YES.
  2. In list settings in the list of content types, there will only be one, called Item. Click Item.
  3. Click Information Management Policy settings.
  4. check the box next to Enable retention
  5. Then click on Add retention stage
  6. next to This stage is based off a date property on the item, pick your closing date field
  7. In Action select Move to Recycle bin enter image description here

This will run daily and if it is closing date it will perform the action to delete item.

  • @P S , no option to defina policy under information mgmt policy settings. – Jason May 31 '16 at 4:50
  • In information management policy check whether you have option to "Enable Retention" that will do it – P S May 31 '16 at 6:35
  • I have updated my answer. no need of workflow. – P S May 31 '16 at 6:41
  • This is what I have set as per my requirement. Pic link: imgur.com/KOKq2gT questions: a) will the closing date + 0 days will work? b) will it the Information mgmt policy repeat everyday and if yes what time? – Jason May 31 '16 at 7:47
  • a) It should work, b)There is timer job "Information Management Policy" check its schedule, if it is weekly make it daily – P S May 31 '16 at 8:50
2

I got the solution, created a workflow and set it run on all items every night to do the following. Check workflow Screenshot -

http://imgur.com/5VtnPRE

Please note: Information MGMT policy didn't ran in my case and if it would have still would have ran the workflow once, wherein the first item in the list would have been checked by workflow and not all items.

In order to run daily on all items and not just current item (usually workflow will run on one item at a time) -

Powershell Code

# URL of the Site 
$web = Get-SPWeb -Identity "example.com"

$manager = $web.Site.WorkFlowManager 

# Name of the list 
$list = $web.Lists["List name"] 

# Name of the Workflow 
$assoc = $list.WorkflowAssociations.GetAssociationByName("Workflow name","en-US") 

$data = $assoc.AssociationData 
$items = $list.Items 
foreach($item in $items) 
 { 
 $wf = $manager.StartWorkFlow($item,$assoc,$data,$true) 
 } 

$manager.Dispose() 
$web.Dispose()

Hope the solution helps others.

1

I already answered similar requirement at post Delete item post closing date in SPS 2013 List.

We have Pause Until option available in SPD. You can specify your Closing date in Pause Until action and then write deleting item logic.

For more detail please have a look to this Delete list item after specific duration using SharePoint designer workflow

Another approach:

You can create a SP Timer Job which can be scheduled for particular time duration and in Timer Job check your closing date and execute your logic there.

Let me know your thoughts.

  • in my case I want the woirkflow to run all the time and it should search for field closing date when it reaches Today then should execute the workflow. I did added the pause in the past, but it trigger only when the item is edited in the SPS 2013 List. In my case once the data is feeded no modification or update will happen on the list. So wondering how the workflow would trigger to execute when the closing date is Today. Please check the workflow image for more understanding: imgur.com/dZgh6yG Kindly help. – Jason May 31 '16 at 4:41
  • I am updating my answer with one more approach. – Aakash Maurya May 31 '16 at 4:45
  • I m following this article to create a powershell and set it as a windows task to run it daily at midnight once. Link: thesysadminhimself.com/2013/09/… Please confirm if its fine. – Jason May 31 '16 at 6:55
  • Also, within workflow do we have an option that scans all items rather just the current item for the closing date and if it matches to Today then execute the action part of workflow. Example: If 4 Items have closing date as Today date, then the workflow to execute for al l4 at once. (As I`ll schedule a windows task to run the workflow once in a day) – Jason May 31 '16 at 6:58
  • 1
    update I was able to map a powershell to my workflow, so now the workflow executes on all items within a list at the same time. Which is good and expected. However, my workflow delete the items that don't have the closing date same as the system date. Wondering what change to check if the closing is system date if not don't do anything. – Jason Jun 1 '16 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.