Jul
1
Item Expiration
Guest Author: Eric Alexander, Moderator, Stump the Panel
This article comes about from a question from illegal operation in Stump the Panel. He writes:
I’ve been expermenting with workflows, and have one almost working the way I want. Basically what I want to do is this.
The list in question has these fields.
Staff Contact
Renewal DateThe worksflow starts when the item is created, then pauses until the renewal date. On the renewal date, it sends out an email to the staff contact reminding them that it’s due, and to update their subscription infomation.
So far I have it almost working, it pauses until the renewal date, and then sends the email. Then if the person goes back and updates the item, it then goes back to pausing until the new renewal date.
But…
If a person goes in before it expires and updates the renewal date, the workflow doesn’t reflect the new date. For example, say it was to expire on 6/15 the users already knows this and goes in and updates their information today 6/12. They enter their new renewal date of 7/12. The workflow is still only paused til 6/12, and will send the email out too early.
So I need to add something to my workflow to always update that pause duration. Here is how my workflow is setup now. It’s set to automatically start when new item created, and start when item is changed.
Condition
If renweal date is greater then today
Pause until Subscription Data Renewal Date
Then send email Staff Contact.What can I add to make it update the workflow when items are changed before they are due?
Jim Bob offered a possible solution with dual workflows on the list. I thought of another solution using Information Policy Settings and a work flow. The idea for this came from a screencast I saw that used document expiration policies to serve as a publishing mechanism for Announcements. I thought information management could be a good candidate to solve this problem. After some testing, it will work but there are some caveats to this solution:
- This is a MOSS only option. WSS users will have to find another way.
- The timer job that handles expiration policy on the server runs only once per day. It cannot be altered to run more frequently.
If you can live with these caveats, let’s begin.
The Content Type
In the original problem description, it was noted this list was nothing more than an internal contact and a renewal date. We’ll use this information to construct a content type for the list we will create later.
- Click Site Actions, Site Settings.
- Click on Site Content Types from the galleries section.
- Click Create.
- Give the new content type a name. I’ll be using Customer Contract throughout the article for this content type.
- Set the parent options as List Content Types Item. If you have a lot of content types already defined, you can create a new group. In this example, I’m putting it in the custom group. Your settings should look like the below. When complete, click OK.

The Columns
After clicking OK to create the content type, you’ll be directed to the options page for the newly created content type. Now it’s time to add the desired columns to this content type.
- Click Add from new site column since our columns don’t exist.
- Name the Column Staff Contact and set the type to Person or Group.
- If you have a lot of site columns already, you may want to create a new group to house the columns. If not, using the custom group is fine. Give the column a description.
- Leave all other options as they are and click OK.
- When the page refreshes, click on the Title link.
- Set the Column Setting type to Optional and click OK.
- When the page refreshes, click on the Staff Contact link.
- Set the Column Setting type to Required and click OK.
- Now to repeat the process to create the Renewal Date column.
- Set the type to date and time. Put it either in the custom group or the group you created for the last column. Set the format to Date and Time, I’ll explain in a minute why. Click OK.
- When the page refreshes, click the Renewal Date link.
- Set the Column Setting type to Required and click OK.
I chose to set the column as a date and time value to be sure all items are appropriately isolated by the daily expiration timer job. This will ensure all items are captured when they should be.
The List
Now that the content type is created with our columns, it’s time to set up our list to hold it. Standard run of the mill creating a custom list via Site Actions, Create. Name your list, in this example, I named it Contracts. Click Create to complete creation. Now to attach the Customer Contract content type to the list.
- After clicking Create to finish the creation process of the list, the page will refresh and you’ll be sitting inside the Contracts list. Click Settings, List Settings.
- Click Advanced Settings.
- Set the Allow management of content types to Yes and click OK.
- Now you’ll see a new bar on the Settings screen like below.
- Click the Add from existing site content types link.
- Find the Customer Contract content type and add it to the right hand box and click OK.
- When the page refreshes, click the Change new button order and default content type link.
- Using the dropdown boxes, set the Customer Contract to the 1 position and click OK.
- Now click on the Item content type. Click Delete this content type. Click OK to the warning box that pops up.

The list is now ready for new contracts. Content approval can be turned on in the Versioning Settings if, as a manager, you’d like to see the flow of updated contracts or for final approval of them. This will alter the next step, creating the workflow. I am not going to show that in this example, but I will note where to make those changes in the workflow configuration.
The Workflow
Now that the content type and list are ready, we need to configure the process for expired contracts. To do this we’ll crack open Sharepoint Designer and connect to our site. When it opens, click File, New, Workflow.
- Name the workflow Expired Contract, attach it to the Contracts list, and set it to be manually run. Then click Next.
- The first step will be to collect data from a user. We want to know what the new contract date will be. So click Actions, and find Collect Data from User. Click on the data hyperlink to open a wizard. Click the Next button. Give the new task a name, I used New contract date needed in this example. Click Next. Click Add. Create a new field as detailed in the picture.
- Now click the this user hyperlink to configure who the task should be assigned to. This will open a window, double click on the workflow lookup and in the box that appears, select Staff Contact from the bottom drop down box. Click OK two times to finish the configuration of the first step.
- Add a new step to the workflow.
- Now it’s time to take the data that was collected and update the contract date with this new value. Click the Action button and select Update list item. Click the this list hyperlink to open the dialog box. Click Add. Configure the workflow step as pictured below. Click OK 3 times to finish the configuration of the item. Then click Finish.

Click Next. Set the item properties as shown below and click Finish to close the add new item and finish again to close the wizard.



If you would like to test the workflow, create a new contract entry on the contract list. Manually run the work flow, and you will receive a task email sent to you. Click the edit this task button on the email header and you’ll be directed to the EditForm for the task. Enter the new renewal time and click complete. Go back to the contract list and you will see the contract time updated to the time you specified.
If you’d like to leverage content approval, add an update list item step above the collect data process in step 1. Configure this to update the Approval Status to Draft. In step 2, add an additional update item in the update list step to update the Approval Status to pending. Then, if you wish, you can add additional steps to notify the approvers that a new item is pending approval. This could easily turn this into a slick contract review process.
The Policy
The final piece to this puzzle is using Information Rights management to handle all this for us. Go back to the Contracts list and go into the List Settings. Click on the Information management Policy settings link. You should then see the Customer Contract content type listed. Click on this hyperlink. Click the Define a Policy radio button and click OK. Configure the settings as detailed in the below image and click OK.

Finished
The setup is now complete. Everyday, the expiration timer job will run and look for contracts that are past the renewal date. It will send a notification to the responsible person via email that they have a new task. When they click the edit this task in the email, it will open to the data collection screen for them to enter the new value. When they click the complete button, it will update the list item with that new value.
If a user updates the list item before it actually expires, there are no hung workflows sending reminders off at incorrect times. As noted, the timer job runs once daily to look for expired items and is MOSS only.
Eric http://alexanderblog.info
This is a good alternative to the original solution involving paused workflows.
This may be a bit outside this most excellent article, however, not only will this require MOSS, but also, if I am not mistaken, that there be a Rights Management Server (RMS) present and configured in the network.
Things to remember about workflows that are “waiting” until something happens before continuing:
1) They are considered active processes/jobs and are constantly using server resources to “listen” for their defined criteria.
2) Since they are not completed they may be interupted and never finish should there be any problems with the SP environment such as IISResets, server restarts, lost network connections, content DB timeouts, or just timer job timeouts.
3) Be prepared for the criteria to never be met and the workflow never finish. This may happen for any number of reasons – especially if waiting for dates.
4) A waiting workflow does not preclude another workflow being started on the same list item.
5) OOTB there is no way for one workflow to influence another. You could create a custom SPD workflow activity via WWF for this, but if you are going that route, you may as well just code the entire workflow via VS and WWF and open up the world of .Net and machine-state workflows. This would allow you to code the exact behavior wanted.
Another alternative would be to introduce the concept of a SharePoint record center, which has some built-in capabilities to configure retention policies.
Thanks for the feedback. This doesn’t require a RMS in the network, MOSS takes care of it all or am I missing something.
This still has some “pause time” until the appropriate person updates the record, but it is drastically reduced from the initial workflow.
I’ve never been able to configure IRM in SharePoint without referencing a Rights Management Server in the network. The RMS is what interfaces with AD and where global IRM policies are set. SharePoint expands upon these, but could never violate them.
At least that has been my experience.
I tried something similar, but after the expiration policy runs the first time, it automatically sets the item exempt from the policy, preventing it from ever running the workflow again. How did you get around this exemption?
Hi there,
I have recently developed a reminder workflow with a reminder message, reciepents, reminder date fields which is attached to a content type of reminder.
This is then attached to the document library and runs pretty much as you wanted. It grabs the values and sleeps for the time it needs to and then sends the email. It then resets if someone goes in and updates the information at any time.
This was all done for a WSS install with no problems and works great. The one difference was that it was created in WF not SPD. Using WF is so powerful and not too difficult to figure out and will produce exactly what you want.
Greate article…….but tell me if I m wrong what I got from here is workflow is doing two tasks over here:
getting information from user
updating that information to update the contract date
where is the thing that it will send email to user and it will pause till contract date…