SharePoint 2013-Printing List Item Forms using jQuery and CSS

UPDATE 4/26/2014:

Have heard from a lot of people who are having some challenges putting all the pieces of this solution together, particularly the calculated field for the print icon.  Providing detailed instructions and a screenshot to get started.

Start from a new team site:

  • Create a new subsite from the Collaboration template using the Team Site template.
  • Use listprint for the site name and URL.
  • Create a new picture library named “Images1″
  • Upload the print icon to the picture library.  Download image here
  • Create a custom list named “List”
  • Add the following columns to the list:
  • Column name: Printed | Column Type: Text | Default value: No
  • Column name: Print Item | Column Type: Calculated Column  Download calculated field formula example here

Capture

 

 

 

 

 

 

 

 

  • Add a new item to the list.
  • Click on the new item link.
  • From the standard DispForm.aspx page select Settings > Edit page
  • Add a new Script Editor web-part to the page (located in the Media and Content Category in web part gallery)
  • Set the Script Editor web-part properties zone index to 2 from the web part settings, layout section.
  • Select Edit Snippet in the Script Editor webpart and paste in the following jQuery/CSS-Download script here
  • Update the siteUrl variable in the jquery to use your site URL as required.
  • Select Page, Stop Editing from the SharePoint ribbon.
  • From site contents select “List”
  • Select a link to one of the two items in the list, select the Print button.
  • From site contents select “List” and notice the first item in the list has been updated to reflect Printed=Yes.

That’s it to getting started.

I have paired down the solution to get you started and make additional customizations specific to your requirements for example the listitemid that gets updated is hard-coded to the first item id since my solution depends on a SharePoint Designer workflow which I did not package up in the wsp (Coming soon) This can be easily updated to use your own jQuery inside the script editor web-part to obtain from the querystring on dispform.aspx or from a custom field that is populated from a SPD workflow when the item gets created.  You can easily create a list on any existing SharePoint 2013 or Office 365 SharePoint site providing you update the script and calculated columns to reflect the correct URLs and image source in the jQuery embedded in the Script Editor web-part and also the Print Item calculated field formula.

Thanks, Rod.

Added Functionality verses standard list item form:

* Add a print button to a SharePoint list item form.

* Displays a print icon linked to the custom print preview form.

* Tracks which list items were printed by the user. Works on both Office 365 and on-premises versions of SharePoint 2013.

printfeature

Capture

 

 

 

 

 

 

Solution Details

Solution designed to meet a requirement from a customer to allow users to easily print a list item from the primary SharePoint list view page in a layout that maximized the allowable printing real-estate while also removing most of the SharePoint toolbars etc. from the printed page.  Also, the customer requested that we track which items had been printed since this solution was part of a larger scheduling solution for SharePoint.   Since the customer is hosting their SharePoint on Office 365 in the cloud we opted to use jQuery and CSS directly on the list item form.  For layout we opted to use a custom list item display form and modify the XSL although this is not necessary to support the jQuery and CSS for printing the list item.

Steps: 

  • jQuery added to list item form with embedded jQuery and CSS overrides in a script editor web-part.
  • Calculated field with a print icon and link to list item form added to the list view.
  • Optional: Customized list item form layout using XSL.

Next Steps:

Package as a SharePoint app that can be added to any site.
Create a custom print template.
Incorporate PDF.

Summary

Even in 2013 it is sometimes necessary to print to paper.  With SharePoint being used more and more for scheduling and tracking systems, workflows, and calendaring the ability to print a SharePoint list item when necessary is an added benefit.  With the advent of CSOM and JSOM developers are increasingly taking advantage of jQuery, HTML, and CSS to tackle specific gaps in the OOB SharePoint features and particularly in the O365 cloud version.

Have fun!

Rod.

SharePoint 2010 Upgrade Tips and Dreaded User Profile Synchronization Service Stuck on Starting…

SharePoint 2010 Upgrade Tips:

I have been working with SharePoint since way back in 2000 when I started at Microsoft, with every release of the product the upgrade process has been getting easier. If you are upgrading only content databases, no significant customizations are detected, and are not planning on upgrading MySites then upgrading SP2007 to SP2010 is very straight-forward using the database attach method, virtually bullet-proof from  my experience over a multitude of SP2010 upgrades both small and large. If however significant customizations are detected (covering in more detail in subsequent post) have been deployed and/or you are upgrading MySites (focus of this post) then a successful migration requires a solid assessment and planning to limit impact to the business. I always strive to limit the impact of the upgrade on the business keeping the production upgrade in as short of a window as possible: “Everyone leaves on Friday with SP2007 and comes in on Monday with SP2010″:)   To that end sharing a few of the lessons learned during recent SharePoint 2010 upgrades for those of you in the planning stages of an upgrade.  Not a comprehensive guide, for a more comprehensive list of upgrade planning steps the place to start is the SharePoint 2010 Upgrade documentation on TechNet.

Tip #1: Perform Database Attach as the upgrade approach: Database attach is the best upgrade approach providing you put the necessary time into planning the upgrade including planning for several test upgrades particularly if you are upgrading MySites as well. Also provides a viable rollback plan if production upgrade fails-reset the databases to read/write while you address upgrade issues and schedule another pass-live to fight another day:)

Tip #2: Perform Test Upgrades and document results: Always perform test upgrades on a virtual machine in advance of production upgrade to resolve issues and verify a successful upgrade path.

  • Document: Document successful  upgrade path based on test upgrades, including environment variables and PowerShell  scripts with the assumption you could follow step-by-step on production      upgrade. Great documentation to provide IT for future reference as a runbook.
  • Test on production hardware and configuration: Consider a test upgrade pass on the new SP2010 production environment prior to actual production upgrade to identify and address environment variables prior to actual production      upgrade weekend i.e. web part caching issues in production environment  where NLB is configured, web.config modifications, SMTP out-bound and  in-bound email,  Alternate Access Mappings, IIS Bindings, all general configurations. You do not want to address these during actual production upgrade for release!
  • Hint: Plan for available free disk space of 3-times the size of the content database or  user profile database you are planning to upgrade. When upgrading a database exceeding 100GB expect the upgrade process to take some time. I was upgrading a content database of 100GB in one scenario and noticed the upgrade progress stayed at .30% complete for some time, after a duration of 2 hours it eventually upgraded so don’t end the process too soon. Monitor the SharePoint upgrade log file if you suspect it’s taking too long.

Tip #3: Provide adequate time to identify and address customizations:

  • STSADM Pre-Upgrade Checker and PowerShell Test-SPContentDatabase are  required. If you are not familiar with STSADM already then could be rough going:) Overall, being proficient in PowerShell is a pre-requisite skill  for SharePoint 2010 upgrade.
  • Consider how best to deal with the Fab 40 templates and provide ample time if you need  to provide support in SP2010 for existing Fab 40 sites.
  • Determine the need to upgrade InfoPath form administrator templates in Central Administration Form Template Library as these may have to be upgraded manually and there could be custom dlls that need to be migrated as well.
  • Plan for addressing custom applications, services, and custom and/or third-party web-parts.
  • Transfer the customizations into the test upgrade environment and test thoroughly.
  • Consider transferring customizations you plan to keep to production environment prior to actual production upgrade and test against production environment to eliminate environmental variables to address during production upgrade i.e. web part caching issues in environment where NLB is configured, web.config modifications, SMTP out-bound and in-bound email, Alternate Access Mappings, IIS Bindings, and all general configurations.

Tip #4: MySite Upgrades:

  • For MySite upgrades do not forget to create or upgrade the MySite host and set MySite      host URL in Profile Service Application prior to upgrading MySites.
  • Create a new web application to host MySites when possible,  I have found no issues with deploying a new site collection for the MySite host rather than upgrading the SP2007 MySite host with the exception of scenario where the MySite host was originally created in the default web application on port 80. Recommend hosting the MySites site collections as part of a separate web application providing a level of isolation for MySites.
  • Use PowerShell to upgrade MySite SSP and provision UPS application pool etc. Ensure you reference the correct Shared Services Database typically SharedServicesDB etc. rather than the MySite content database when activating User Profile Service Application.

Tip #5: Plan to address the Dreaded User Profile Synchronization Service not starting… You have successfully upgraded your content databases via the recommended database attach upgrade and proceeded to the MySite upgrade process. After completing the upgrade of the profile db following the steps on TechNet to the letter and in preparation had reviewed the UPS Architecture when you advance to the step to configure your profile service application settings i.e. to set the MySite host link SharePoint on the Profile Service Application management link it returns an error page instead of the expected  administration page. Potential cause: the user profile synchronization service is not started.  On more than one occasion I noticed the profile synchronization service was stuck on starting in the manage services administration page for more than 10 minutes after provisioning and activating the UPS and until the service is started you will not be able to access the manage profile service application page.

Resolution: There have been many posts dedicated to resolving the profile sync stuck on starting. Here is one of my favorites http://www.harbar.net/articles/sp2010ups2.aspx that includes significant detail and troubleshooting steps.  TechNet article http://technet.microsoft.com/en-us/library/gg750253.aspx   Recommend reviewing these posts in cases where following the steps I outline below are not successful. There are cases where permissions have not been set properly in AD, NetBIOS issue, or security access issues with the FIM Services themselves that will require access to both SharePoint, SQL, and Active Directory to resolve.  In such cases I involve IT Admin/IT Services team and in some cases contacting Microsoft support. In one case with MS support assistance uncovered changes made to the AD containers were causing synchronization errors.

Quick steps to try before getting too deep into the weeds that has worked for me over the course of several SP2010 Upgrades.

  • Ensure you have installed SharePoint latest SharePoint 2010 cumulative updates http://technet.microsoft.com/en-us/office/sharepointserver/bb735839
  • Ensure the ForeFront Identity Management Services are enabled and set to manual start and configure to run under your service account. DO NOT START YOURSELF-the user profile service will attempt to configure and start these services automatically.
  • Start the Profile Service application from Central Administration (in addition to the Profile Synchronization Service)
  • Reboot the SharePoint server.
  • Verify FIM  services are started. Hint: You can view FIM services in action using the FIM Client located at C:\Program Files\Microsoft Office Servers\14.0\Synchronization Service\UIShell\miisclient.exe
  • Verify the Profile Synchronization Service and User Profile Service status are both reporting as “Started” and no longer “Starting”
  • If the Profile Synchronization Service status is still stuck on starting, try setting the FIM Services to “Automatic-Delayed Start” then Reboot once more.
  • At this point your profile synchronization service status should be reporting as started, review errors in event log, and if successful you will be able to access the Profile Sync Settings page and verify the user profiles have been successfully imported, configure your MySite settings etc.
  • Hint: Do not be shy about deleting the UPS application and re-activating using PowerShell from scratch once more to ensure all configurations are correct.
  • Consider turning off the SMTP service to disable email during user profile upgrade to avoid emails being sent out to Managers from the MySite Cleaner Timer Job.

Summary:

Performing database attach upgrade is a great approach for planning an upgrade that limits the overall impact to the business and provides best roll-back plan. Plan for several test upgrade passes to get to a successful upgrade pass, particularly if upgrading customizations and/or MySites. Document the test results as part of a step-by-step upgrade guide that includes each step, environmental variables i.e. server names, service accounts, database names, general configurations, list of customizations, and accompanying PowerShell scripts will help make the actual production upgrade go smoothly.  Also consider the additional step of performing a test upgrade on the planned production environment to identify and address environmental variables early. Plan out the production upgrade tasks, activities day by day, including all tasks, resources, and estimated time necessary for copying databases from production, estimate for performing database upgrade, and allocated time/resources for performing post-upgrade testing.

Most importantly, bring coffee.

Rod Stagg
SharePoint Practice Manager and Architect http://www.rstagg.com

SharePoint Intelligence Conference Bellevue KeyNote Take Aways

In Bellevue for the conference, key takeaways from keynote.

Self service BI tools are compelling in SharePoint 2010 in conjunction with SharePoint SQL Server 2008 R2 and upcoming SQL Server 2012.
Adoption of SharePoint is being driven by organizatizations seeking a unified Infrastructure reducing impact to IT freeing time for strategic initiatives

LINQ and integrated Voice Messaging worth looking into, shows presence in SharePoint 2010 and an interesting feature in Outlook that summarizes cm in text and search.

Unified Communications offer potential ROI opportunities.

 

Holiday Gift SharePoint to help others during the holidays

Using SharePoint to help others during the holidays

For the past several years, our employees have helped make the holidays very happy for many local children.  Because of thier thoughtfulness and generosity, these children woke up to presents and a wonderful Holiday Season.   Last year you helped a homeless family of six move into an apartment for the holidays – and if that wasn’t enough, fulfilled the kid’s wish lists! 

Again, this year we have a wonderful family who is going through some hard times.  A single mom with four children who works full time but struggles to make ends meet.  Last year, she was only able to get a few gifts for the youngest child.  We thought it be great if we could make this holiday a good one for all of them and knew this family would appreciate any help we can offer.  

This year we have a Holiday Gift SharePoint!

How SharePoint can help:
In previous years we sent out an email similiar to the above.  Thanks to the generousity of our employees many of the gifts came in time for the holidays, some even 2 or 3 times! 

Preventing duplicate gifts:
This year we wondered if we could provide the holidays wish list that could work much like a wedding registry preventing duplicated gifts.  When employees purhase a gift, they could go to the list and mark off that it is fulfilled. 
 
In SharePoint this turned out to be easy and fast to implement: 
  1. Create a custom list to store the holiday gift wish list items.
  2. Add fields for a picture of the gift, title, family member, and check-off field.
  3. Populate list with gift items.
  4. Create a new site page and add the gift list as a web-part to the page.
  5. Configure the list view to enable inline editing.
  6. Add content explaining how to view and select items from the list.
  7. Optional: Create a SharePoint Designer Workflow to automatically send out a thank you email.

Increasing Participation:

To increase participation we made the SharePoint accessible to more employees and also partners by enabling claims-based authentication and providing access through the firewall. 

Happy Holidays!

Configure Dataview Webpart to display results from a centralized list regardless of what site level

If you need to deploy a customized dataview web-part (customized in SharePoint Designer) across multiple sites within a site collection this may be a good option particularly if you want each instance of the dataview web-part to query and render the data from a single list.  Useful anytime you want to store the data in a centralized location, customize the dataview web-part in SharePoint Designer, and upload to the web-part gallery for use on any subsite.    Applies to SharePoint 2010 and SharePoint 2007 and WSS as well. 

Steps:

1) Convert your dataview web-part to XSLT in SharePoint Designer

2) Locate the SharePoint:SPDataSource control in code view

3) Locate the SelectCommand section and add the webs scope to your dataview web-parts SelectCommand directly preceding the select query:

SelectCommand=”<Webs Scope=’Recursive’></Webs>&lt;View&gt;&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name=&quot;Order&quot;/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;/View&gt;”

4) Add or Modify the WebUrl parameter in your <SelectParameters> section of the datasource ontolr and update the DefaultValue to {sitecollectionroot}:

<asp:Parameter Name=”WebUrl” DefaultValue= “{sitecollectionroot} “/>

5) Save the page, open in browser and export dataview web-part to your computer.

6) From Site Action, Site Settings select the link to the webpart gallery and upload the web-part to the web part gallery or Import the web-part on any site page.

Exporting/Importing SharePoint webparts 

http://office.microsoft.com/en-us/sharepoint-server-help/manage-and-share-web-parts-and-web-part-pages-HA010024106.aspx#BM4

Have fun.

Rod

<SharePoint:SPDataSource runat=”server” DataSourceMode=”List” SelectCommand=”<Webs Scope=’Recursive’></Webs>&lt;View&gt;&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name=&quot;Order&quot;/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;/View&gt;” UseInternalName=”True” IncludeHidden=”True” ID=”datasource1″><SelectParameters><asp:Parameter DefaultValue=”{5942043E-EC50-41A2-8A06-513CA392FE65}” Name=”ListID”></asp:Parameter><asp:QueryStringParameter QueryStringField=”RootFolder” Name=”RootFolder” Type=”String”></asp:QueryStringParameter><asp:Parameter DefaultValue=”0″ Name=”StartRowIndex”></asp:Parameter><asp:Parameter DefaultValue=”0″ Name=”nextpagedata”></asp:Parameter><asp:Parameter DefaultValue=”100″ Name=”MaximumRows”></asp:Parameter><asp:Parameter Name=”WebUrl” DefaultValue=”{sitecollectionroot}”/>
</SelectParameters><UpdateParameters><asp:Parameter DefaultValue=”{5942043E-EC50-41A2-8A06-513CA392FE65}” Name=”ListID”></asp:Parameter>
</UpdateParameters><InsertParameters><asp:Parameter DefaultValue=”{5942043E-EC50-41A2-8A06-513CA392FE65}” Name=”ListID”></asp:Parameter>
</InsertParameters><DeleteParameters><asp:Parameter DefaultValue=”{5942043E-EC50-41A2-8A06-513CA392FE65}” Name=”ListID”></asp:Parameter>
</DeleteParameters>
</SharePoint:SPDataSource>

How to bulk upload and synchronize data into SharePoint using the Excel Add-in and SharePoint Designer Workflows

Overview
Provide the ability for selected individuals who need to continue to maintain data in Excel and also share the data with users via SharePoint taking advantage of all SharePoint’s built-in features for lists. 

This solution provides the ability for Excel users to select data stored in their Excel spreadsheet and synchronize the data to a custom SharePoint list eliminating the sometimes redundant and time-consuming process of entering each item individually.

Screenshot from a table in Excel spreadsheet:

TableSyncSharePointContextSmall syncSharePointContextSmall

This scenario is part of an overall solution that takes advantage of SharePoint’s out-of-the-box features including SharePoint Designer workflows and custom lists to provide an online database for event tracking, a database of subject matter experts, workflow processes for resourcing, and incorporating scoring data imported from pre-populated reports downloaded in Excel format.  
In addition the solution uses the new document sets in SharePoint 2010 to allow user to upload and share supporting files and tag supporting files at a folder level eliminating redundant input.

Configuring SharePoint

  • Create a new custom list to serve as a public list that will display the data to end-users.
  • Create a new custom list to serve as an import list supporting the import workflow process.  This list is created directly from the Excel spreadsheet using the Excel Add-in’s Publish and allow Sync command (more later on this).
  • Create a new site column named BulkImportID and that will be added to both the Import List and Public list.  
  • Create a new SharePoint Designer workflow to handle the import process.  Set the workflow to execute when a new item is added to the Import List. 
  • Add logic to the workflow detect whether a new item should be added or whether the item has been previously added to the public list requiring only an update to the list item.  The purpose of the BulkImportID is to be used to evaluate the workflow condition.
  • Using the create item function in the workflow populate the public list with the appropriate values from each newly added item in the import list and set the BulkImportID for each added list item. Delete each list item in the import list using the Delete Item function when the workflow has succeeded for the item.

Installing and Configuring the Excel Add-in

  • Install the Excel Add-in to the user’s desktop or laptop (individuals contributing data to the system) This provides the mechanism to synchronize the data from the user’s Excel spreadsheet to the Import List in SharePoint.
  • Save the spreadsheet as Excel 2003-2007 format as described in the Excel Add-in configuration instructions.  You can also create a copy of the original to support the import process to maintain the original’s advanced features.   
  • Configure the Excel spreadsheet for the Excel Add-in on the Excel spreadsheet by completing the configuration steps.  Create a new table in Excel with your data and use the Publish and allow sync command to deploy your Import List for the first time.  Optionally add a new worksheet to each spreadsheet where the  user can copy in the specific data they need to import to SharePoint preserving the source worksheets.

Advantages

  • Users can continue to use their Excel spreadsheets for advanced computations, offline access, and custom formatting while also being able to share the data via SharePoint. 
  • Users can bulk-import pre-populated spreadsheets and reports provided by other systems into SharePoint. 
  • Custom filtered views including progressive filtering can be created and shared via SharePoint not provided in Excel auto-filtering. 
  • SharePoint Designer workflows provide a non-code mechanism to both import new items into the Public List and also detecting existing items for performing updates.   

Using the Excel Add-in:

publishAndSyncToolBarSmall

Deploy Excel Add-in to selected users who will be importing data from Excel to SharePoint

Brief Description This add-in works with Excel 2007 to allow you to synchronize data in a table with a list on a SharePoint site.

Download from MSDN http://www.microsoft.com/downloads/details.aspx?FamilyId=25836E52-1892-4E17-AC08-5DF13CFC5295&displaylang=en

Configure Excel spreadsheets for Publishing and Synchronizing Excel 2007 Tables to SharePoint Lists

Summary: In Microsoft Office Excel 2007, the ability to synchronize the data between a table and a list in Microsoft Windows SharePoint Services is deprecated. This article describes an add-in that enables you to update the information in a SharePoint list from Excel 2007.

Configuration Instructions
http://msdn.microsoft.com/en-us/library/bb462636(office.11).aspx#Office2007SynchronizeSharePointListfromExcel_Synchronizing

Important considerations when using the Excel Add-in.

  • Create your custom “Import List” directly from the Add-in using the Publish and allow sync command in the Table Tools-Design tab of your Excel spreadsheet provided by the Excel Add-in.  You can add your own fields to the Import List later and synchronize with Excel. 
    Think carefully about what fields you want as required fields and the desired order in your spreadsheet before provisioning the Import List since the field order is difficult to re-arrange once the Excel spreadsheet is connected to SharePoint. 
  • Take advantage of the ability for the Excel spreadsheet to incorporate pick-lists from the columns in your SharePoint Import list. 
  • There is a limit of 6 fields if I remember correctly and you are not able to provide for multiple selections but very usefull for maintaining data consistancy and case where selecting users from AD would be usefull.
  • A common confusion I have seen on MSDN for users implementing the add-in is the Publish and allow Sync command in the Excel toolbar.  Some users attempt to select this command to sync the data with SharePoint.  This command is only used to provision the initial list in SharePoint bound to the Excel table and not used for updates.  For updates right-click anywhere on the Excel table and use the additional features added to the context-menu to sync data (see screenshot above)

Conclusion

There are circumstances when users need to continue to use existing Excel spreadsheets and adding each data item to SharePoint individually would be both redundant and time-consuming.  Using the Excel Add-in in combination with custom Import Lists and SharePoint Designer workflows provide one mechanism for bulk-uploading data from Excel to SharePoint. 

How to allow users to run a SharePoint Designer workflow on multiple list items.

Overview:
Design and deploy a solution based on SharePoint 2010 to store and track data on events. 

Technical Approach:

  • Use SharePoint 2010 lists, libraries, and content types to store and track event data.

  • Develop SharePoint Designer 2010 workflows to standardize and replace current manual processes and provide secured views of sensitive data. 

  • Use SharePoint Designer 2010 workflows for data migration from current Excel spreadsheets and Access database.

  • Provide customized reporting using customized SharePoint 2010 list views and Microsoft Access 2010′s ability to generate reports based on data stored in SharePoint 2010. 

Challenge: How to provide the user the ability to quickly kick-off a workflow on multiple events all in the same view.

We ran into a challenge on a key requirement to allow the user to quickly kick-off a workflow on multiple events all in the same view.  Given the large number of events involved it would be a time-consuming process for the user to select each list item representing the event, edit the final event details, and run the associated workflow process to complete and close the event. 

We evaluated using one of the new out-of-the-box features of SharePoint 2010: the ability to multiple select items in a list and perform an action.   This could have been an easy way to provide the user the ability to a workflow on multiple list items- the ideal solution-simply instruct the user to select multiple list items in the default view, select the workflow button in the ribbon, and execute the workflow.  

The challenge? It appears the actions you can perform on multiple list items are limited to edit and delete, workflows are not included.   It is not clear to us if this is by design (SharePoint Designer team can jump in here and clarify if we are missing something I am sure) but since the workflow button is de-activated when selecting more than one list item and time was short we proceeded to investigate another possible solution. 

Screenshot of standard list view with multiple list items selected demonstrating the ability to edit and delete multiple items but workflow command de-activated.

ViewEvents
Screenshot of identical standard list view with a single list item selected demonstrating the ability to run a workflow against a single item only.

WorkflowSingleItem

How then to provide a mechanism in the user interface to allow the event coordinator to quickly and easily update information on multiple events without requiring a time-consuming process to open each and every event from the default SharePoint item edit view, update, and run the associated SharePoint workflow to complete the event?  Tires me just saying it. 

Solution:

Use the SharePoint multiple item form in conjunction with SharePoint Designer workflow ability to execute on list item updates.

  • Create a new field to designate the event as complete using the checkbox field type, one value for yes and no default value.

  • Create a new aspx page from the masterpage using SharePoint Designer, insert a dataview, select the appropriate fields in the datasource details pane, and insert as a multiple item form. 

  • Although multiple item forms are similiar to the datasheet view they provide the ability to customize to your scenario.

  • Add the complete column to the dataview to provide the checkboxes to designate the event as completed.

  • Set the close workflow settings to execute when an item has changed and add a condition to the workflow to check the complete status prior to execution i.e. if the event has already been closed do not execute workflow.  Easy addition would be to provide filtered views of the Event list by Complete=Yes and Complete =.

  • When the user selects the Complete event checkbox on multiple events and selects save the values in each associated list item is updated which in turn begins execution of the workflow for each list item selected. 

Screenshot of an example custom SharePoint list item form in the Multiple Item Form view.  

 CloseEventSmall

The user is able to select multiple events and designate as completed using the new Complete checkbox, update the event details using the fields in the multiple item form, and select Save.  The workflow will then begin execution on each item as they are updated.

Of course you can customize this page to suit your needs-SharePoint Designer 2010 provides a full range of options including conditional formatting, filtered views, and advanced editing mode. 

Important considerations when using customized list forms and workflows:

  • Use conditional clauses to ensure you don’t create infinite loops and workflows are executed only when appropriate.

  • I recommend creating an entirely new .aspx page rather then editing the built-in list forms for adding a multiple item view when possible.

  • When editing existing list forms i.e. editform.aspx be carefull not to delete the list form control but use the web-part settings to hide instead.

Summary:

Using the SharePoint custom multiple item form is one method to provide the user a quick and easy way to edit multiple list items and an excellent alternative to the default single item edit form.

Although similar to the datasheet view multiple item forms are customizable.  

When the list is associated with a workflow the user has the ability to perform workflow actions on multiple list items as well. 

Migrating Data Into Existing SharePoint Lists using SharePoint Designer

Overview

Recently our IT department embarked on a collaborative effort with a key business stakeholder to develop a standardized quoting and bidding solution. The solution is an interim solution (2 years) replacing a current set of processes (both manual and automated). We needed to develop the solution quickly and efficiently to address a current need.

The solution:

Take advantage of SharePoint’s collaboration and document sharing features and built-in workflow capabilities for lists and document libraries to provide a standardized workflow process and centralized repository for tracking and reporting purposes.

Example SharePoint Designer Workflow

The challenge:

Migrating historical data into existing SharePoint lists and libraries.  A key requirement required migration of historical data into the new solution’s lists, document libraries, and ensure they function properly with existing SharePoint Designer workflows.

No Easy Button:

We quickly determined importing the data into SharePoint as entirely new lists from either Excel or Access by itself was not a viable option given the approximately 100 fields involved that varied in type from datasource to another.

The historical data was stored in Excel spreadsheets and Access databases.  In one case 10,000+ records were stored in a single Access 2003 database.

Solution approach for migrating the data:

To save time consider using SharePoint Designer workflows to map the fields and import the data into existing lists.  SPD workflows don’t have built-in looping but you can kick off workflows on each item in the list by setting the workflow to initiate on item edit and then use Access to append a field in each item in the list.

Steps we took to manage the migration:

  • Import the existing historical data stored in Excel Spreadsheets directly into SharePoint as new temporary lists to be deleted when migration was complete.
  • Export the data stored in the Access databases directly to temporary lists in SharePoint using the export to Windows SharePoint Services feature.
  • Develop SharePoint Designer workflows for each temporary list and set the workflow to start manually and also whenever a list item is updated.
  • Add a custom column to each list to track whether an item had been migrated. 
  • Add a workflow condition to check whether the item has already been migrated before starting the workflow i.e. if the custom migrated field equals “notmigated” initiate the workflow.
  • Add actions to create a new list item in the destination list(s) for each desired field/value from the source temporary list.
  • Add a final step to the workflow to update the current item’s migrated field to “migrated” following the creation of the new list item preventing the workflow from looping endlessly.
  • Run an append query from Access to update the custom migrated field in each list item of the temporary list.  This update initiates the workflows.
  • If necessary develop a simple Windows application to append a specific field in every row of the temporary SharePoint list.  In our case Access was timing out for our large number of records. 
  • We handled special cases for data mapping in code in specific cases where our historical data contained values not present in our new choice fields.
  • Monitor your source temporary lists and destination lists to ensure the workflow runs successfully.

Key Take-Aways:

Server Settings:
Depending on your server settings it may be necessary to update your server’s workflow settings to accommodate a large number of concurrent workflows. I changed the timeout to 25 minutes.
See http://msdn.microsoft.com/en-us/library/dd441390.aspx

Create new list items rather than copying. Creating new list items in your workflows and providing the associated mappings turned out to be more reliable than copying list items.

Re-use workflows when possible.
We saved time by reusing the same SharePoint Designer workflow on another separate list by simply replacing the listid GUID in your workflows .xoml file

CreateItemActivity ListId="{}{[yourlistsid]}" x:Name="ID30" Overwrite="False" __Context="{ActivityBind ROOT,Path=__context

Use content-types:
When working with a large number of fields consider grouping into content types if appropriate. This is especially useful if you need the ability to easily filter based on the original datasource or want to provide a specialized form based on the originating datasource.

Manage list size:

For large number of data items consider using separate lists in your solution to limit the number of total list items in any one list to 5,000 or less. 

Other Approaches we considered:

Develop the code in C# and use the SharePoint object model to both import/export the data to SharePoint and also provide the mapping of fields. Given the number of fields approached 100+ we determined handling everything in custom code was not the most efficient approach.

Use Access to import all the Excel spreadsheets into the Access database and then create append queries in Access to append the data into the existing SharePoint lists. Seems like the obvious approach but after testing with a subset of the 100+ required fields we determined ensuring that each field/data type in Access was compatible with the corresponding fields/data type in the SharePoint lists was too time-consuming.

Also, possibly related to the large number of records 10,000 involved, the Access append query we used for testing frequently timed-out or locked-up before completing.