Multiple Web Part Connections in SharePoint 2010

Unlike SharePoint 2007, SharePoint 2010 allows you to do more than one web part connection to a list view web part out of the box! That also means you can use more than one filter web part on a list view web part!

Here is a screen shot that exemplifies using multiple web part connections:

projectWPconn

In this screenshot, a user can filter by the project AND by the project phase to find related tasks. Sure you can filter the “Related Project” and “Project Phase” fields on the Tasks list view web part separately by clicking on each of the field titles and filtering them but using web part connections makes it easier for the user to switch between projects and project phases. Also, if the user is new to SharePoint, it’s not immediately obvious that you can filter by clicking on the field title, whereas clicking on a project to filter all tasks related to the project is more intuitive.

You can even add to this example by using filter web parts – ie. You can use a current user filter web part to show only the tasks assigned to you.

Being able to have multiple web part connections to a list view web part opens the door to all sorts of possibilities for slicing and dicing data within a list!

Visio Services – Using Visio & Web Part Connections to Highlight

In SharePoint 2010, you can use web part connections between a Sharepoint list and a Visio Web Access web part to highlight steps in a process diagram that are associated with a list item:

When you select a different list item, different steps in the process diagram are highlighted:

Here are the steps to build this example:

  1. Open Visio 2010, create a Visio diagram, and save it as a “Web Drawing” file type
  2. Upload the Visio file to a SharePoint document library
  3. In your Sharepoint site, create a web part page and add the Visio Web Access web part to the page. Edit this web part and set the web drawing URL to the Visio file URL
  4. Create a custom list and add a column called “Highlighted Steps.” Choose “Single line of text” as the column type
  5. Create a list item in the custom list. In the “Highlighted Steps” column, add the Shape name(s) that you want to highlight when you select this list item. If it’s multiple shape names, separated them with commas with no space in between. Ex) “Process1,Proccess1”. You can find the shape name by clicking on the shape information pane and then clicking the shape. The shape name shows up in the upper left side of the box. In the example shown in the picture, the shape name is  Process.3.
  6. On the page, add the list view web part for the custom list you created above.
  7. In the edit mode for the page, click the edit dropdown > Connections > Get Shapes to Highlight From > (custom list name)
  8. In the web part connection settings, set the Provider field name to the “Highlighted Steps” column and the Consumer field name to “Shape Names”. Click Finish

Now when you select one of the list items, it will highlight all the shapes associated with the list item.

Reference:

http://blogs.msdn.com/b/visio/archive/2010/02/05/no-code-mashups-with-visio-services-and-web-part-connections.aspx

Visio Services – Using Visio to Connect Processes

Unlike SharePoint 2007, SharePoint 2010 has a Visio web access web part that allows you to show Visio diagrams on your site. One way to leverage this new capability is to show a master detail view of a diagram/process. When you click on a shape in the “master” view, the “details” view will show the information associated with that shape. For example, when you click on the shape for “Phase 1” in the “master” view, the “details” view will show the sub-process related to Phase 1. This is especially helpful when you want both a high level and detail level view of a process.

Fig. 1: Clicking on the Initiation process shows the sub-process for the Initiation process

Fig. 2: Clicking on the Testing process shows the sub-process for the Testing process

These are the steps to build this example:

  1. Open Visio 2010
  2. Click New > Basic Flowchart > Create
  3. Click Save As > Change the file type to “Web Drawing” and save
  4. Create both your main process diagram and sub-process diagrams. Save the main process and sub-processes as two different Visio files.
  5. On the sub-process diagrams: change the page names for each sub-process
  6. On the main diagram: Select the whole process and right-click on the process > Data > Define Shape Data. Click New. Set the label to “subprocess” and type to string. Right click on the first shape > Data > Data Shape. Set the “subprocess” variable to the page name of the sub-process that is associated with the first shape. Repeat this step for all shapes in the main diagram
  7. Open your sharepoint site that you want to display these Visio diagrams
  8. Upload both Visio files to a document library
  9. On a page, add two Visio web access web parts – one is for the main process and one is for the sub-process
  10. Edit the main process Visio web part and set the web drawing URL to the main process Visio file url
  11. In the “Expose the following shape data” field, type the name of the label we created previously, which is “subprocess”
  12. Save the changes made to the main Visio web part
  13. Edit the sub-process Visio web part and set the web drawing URL to the sub-process Visio file url
  14. Save the changes made to the sub-process Visio web part
  15. On the sub-process Visio web part, click edit > Connections > Get Web Drawing URL and Page Name From > (the main process Visio web part) – Provider Field Name: subprocess, Consumer Field Name: Page Name. Click Finish
  16. Exit edit mode of the page (or Publish if the publishing feature is activated)

Creating Nintex workflow constants programmatically

Workflow constants in Nintex workflows are useful for storing constants that can be used across a site. For example, if you store a credential as a workflow constant, you can then use the constant within all Nintex actions that require credentials, such as the “Query User Profile” action. Then when the password is changed, the credential only needs to be changed in one place (as opposed to the case where the credentials are stored in each action and need to be changed within each action).

While you can create a site level workflow constant through the UI by going to the site’s settings and then “Manage workflow constants,” it’s possible to create a workflow constant programmatically.

Here is the code for that:

public static void CreateWorkflowConstant(string title, string description, string value, bool sensitive, Guid siteId, Guid webId, WorkflowConstant.WorkflowConstantType type, bool adminOnly) {

var oc = new WorkflowConstant(title, description, value, sensitive, siteId, webId, type, adminOnly);

oc.Update();

}

public static void CreateCredentialWorkflowConstant(string title, string description, CredentialValue cred, bool sensitive, Guid siteId, Guid webId, bool adminOnly) {

if (cred == null) return;

var serializer = new XmlSerializer(typeof(CredentialValue));

var sb = new StringBuilder();

using (var sw = new StringWriter(sb)) {

serializer.Serialize(sw, cred);

}

var value = sb.ToString();

CreateWorkflowConstant(title, description, value, sensitive, siteId, webId, WorkflowConstant.WorkflowConstantType.Credential, adminOnly);

}

static void Main(string[] args) {

try {

using (SPSite site = new Microsoft.SharePoint.SPSite(<SITE URL>)) {

SPWeb web = site.RootWeb;

var cred = new CredentialValue(@”am\jsaito”, “pwd”);

CreateCredentialWorkflowConstant(“title”, “desc”, cred, true, site.ID, web.ID, false);

web.Update();

}

}

catch (Exception e) {

Console.WriteLine(“Error: ” + e);

Console.ReadLine();

}

}

When you run it, you’ll find that a workflow constant is created on the site collection level:

WorkflowConstant

Workflow Constant added at the site level