Catch 22 for Approval Workflow in SharePoint Designer
Today 02/09 I began blogging on this, and found someone else's blogpost from Dec 2010 who also blogged on this exact topic. Though I never saw his blog post prior to writing this, credit to Lars Nielson.
I ran into an interesting dilemma while working on my most recent project. The project involved a number of document libraries that required content approval as well as versioning.
The scope of work greatly limited the amount of customizations that could be made to SharePoint (i.e. building workflows in Visual Studio).
This introduced an interesting problem based on our initial game plan. The workflow is basically a document goes through a change process and committee approvals before it is published. End Users cannot see changes until an approved document is published.
The change process was the complicated piece to this because the organization had a number of variables within the process, so the only solution was to require each step in the workflow to be manually kicked off.
When I made it to the approval stage, we initially had content approval on in the libraries. And here is where the catch 22 comes in, trying to set content approval status to Approved in a document library that requires a document to be checked out and content approval is on.
To set the content approval status from Designer, ok easy enough, there is an action for that....uh oh, the document must first be checked out. ok, check out document, set approval status....uh oh, I get an error that says content approval status cannot be set while a document is checked out.
Catch 22. Basically to set content approval status in designer, the document must be checked out, but content approval status cannot be changed while a document is checked out.
Possible work-around - We did not go this route, we basically turned off content approval, and used a workflow to notify approvals, and once approval was granted, a user would publish a major version of the document. This was acceptable for this engagement.
I was going to explain the workaround here, but I ran across a blog post while getting my info together of someone who already documented it. So in the spirit of giving credit where credit is due, Lars gets credit for this solution. Lars Nielson blogged on this exact topic in late 2010. http://discoverlars.wordpress.com/2010/12/28/update-the-approval-status-in-a-sharepoint-designer-workflow/
The bottom line in this is that for highly complex workflows, you really need Visual Studio.
Reminder emails a day before for a Calendar Event
Today 11/19/2010 Friday, one of the Users requested that if they can get alerts or notifications for the upcoming calendar events and that they would like to get the notifications the day before the event.
To accomplish the above:
Add a custom field to the calendar called "Alert - 1 day". Make it a calculated field with the calculation [StartTime]-1. Make sure it is a date type. I also specified date and time so the alert goes out exactly one day before, to the minute.
Then also add a custom field to the calendar called "Reminder Recipients". Make it a people picker control and choose to show Email addresses and probably allow multiple selections too.
Next, open your site in SharePoint designer and create a workflow (New > Workflow) for the calendar. Set the workflow to automatically start when the event is created/changed. I also created a workflow variable called "Recipients" of type string. Then my workflow went like this:
If Alert - 1 day is greater than Today
Pause until Calendar:Alert - 1 day
then Set Variable: Recipients to Calendar:Reminder Recipients
then Email Variable: Recipients
Please see the screenshots below