3

I`ve created a workflow from SPD2013 for SPS2013 List, that will delete the list item based on closing date equals to today. Issue, it does it for the only one item, even though if there are more than 1 item with closing date set to today. I understand workflow suggest for incase of multiple items, it will do it for the first. Please suggest if any option to perform delete option for multiple items at once?

1
  • @ahmed can you please assist?
    – Jason
    Jun 1, 2016 at 4:02

2 Answers 2

3

You can set up retention policy to start a workflow when any condition (in your case closing data is today) is satisfied. In that workflow you can set step to delete the item. This way multiple items can trigger workflow to do the required functionality.

4
  • thanks but if I want to in future to perform delete and archive, I guess would be an issue?
    – Jason
    May 30, 2016 at 6:26
  • You are asking about the archiving the item ? In workflow you can do anything as per your functionality. May 30, 2016 at 6:28
  • I understand in workflow u can do anything, but not sure how can I achieve to have all items copied and later deleted if the closing date is of Today?
    – Jason
    Jun 1, 2016 at 1:45
  • copy where ??? Another list ? Jun 1, 2016 at 6:32
0

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

https://i.stack.imgur.com/MKowj.jpg

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()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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