Code Project

Link Unit

Tuesday, July 27, 2010

Multi-Value Columns in SharePoint Designer Workflow

Requirement :

Create a workflow so that any new item created in the list should fire the mail to recipients.

#1 Create a Multi value column in a list

#2 Now on creation of new item attach the workflow to send the mail.

The multi value column is missing in workflow .The SPD suffers from a deficiency in the workflow component ,which doesn't allow you to send e-mail to multiple recipients from a multi-value column of a list using SharePoint Designer 2007 (SPD).

Solution #1

Turn off "Allow multiple selections" for your column (note the warning "This will remove all person values except the first one") . Now you should be able to provide the column as lookup column in workflow.

Change the workflow and then turn "Allow multiple selections" on for your column.

This solution is not acceptable as it removes all the values except first value. So the approach is good till development but once workflow goes to production you won't be able to touch the workflow or list where you would like to turn off "Allow multiple selections"

Solution #2

Create a variable var _employees in workflow

Set the value of variable "_employees" to your "multi value column".

Send the email using the variable "_employees"

The second solution is simple and elegant.


I hope it helps.

Monday, July 26, 2010

LOC in DOS

Though LOC for estimation is not very reliable , but still in case you need to find LOC of existing project. One way is to write a piece of code in your preferred language C#/VB.Net etc or another way is using some command like wc -l as in Linux.
In DOS there is no such command directly availiable , so how to go about this one?? I assume nobody is going to write pharse "I am genius" in deployed code.
So the trick is to find nonexisting text[/v] in lines and count those lines [/c]. For this to work copy all the source code files in one directory and run the following
C:\CS> find "I am genius" /c/v *.cs >ABC
Hope it helps

Filtering By ListTextField for GridDropDownColumn

We were using Radgrid for displaying/Editing information and to filter rows we were using filter mechanism as given by RadGrid. The issue faced was that we were unable to filter the rows on the GridDropDownColumn , so we tried to follow the suggestion as given at telerik site http://www.telerik.com/help/aspnet-ajax/grdfilteringbylisttextfieldforgriddropdowncolumn.html

We tried the suggestion #1 , everything was fine for display purpose. But as soon as we try to edit or Add a new row we were able to view both Hidden GridBoundColumn and GridDropdownColumn , and the value of both were getting passed to the objectdatasource we had for DML operations.

Now to solve the problem we used "readonly=true" for GridBoundColumn and it simply disappeared from edit form.
Explaination
In case editable column types (column types that implement the IGridEditableColumn interface) have a ReadOnly property that determines whether the column editor is visible in the edit form. When ReadOnly is True, the column editor does not appear in the edit form. ReadOnly does not affect whether the column is visible in browser mode.

I hope it helps