Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Initiate a Workflow from a List View

  Asked By: Raul    Date: Jan 01    Category: Sharepoint    Views: 15507

I have a requirement to allow users to click on a link or button in a
list view and have that initiate a workflow.

I have tried using a customised view page with a hyperlink field
which points to the IniWrkflIP.aspx page in the layouts directory.
However this appears to be expecting an initiation form and some of
the workflow types I am dealing with do not require initiation data.

I could write a custom aspx page which simply takes the appropriate
parameters and uses the OM to kick off the workflow, but I would have
to look into how that code might look.

I was wondering if there was an easier solution to this. Its
annoying really as I am told that the users involved would find
selecting the workflow via the standard browser UI would be too

I have looked into custom field controls, but the list view control
is rendered using a RenderPattern defined in CAML rather than the
custom control which would be used in the edit and new forms.



3 Answers Found

Answer #1    Answered By: .net Guru     Answered On: Jan 01

The way I thought of to do this, is to create a new hyperlink  field
in your list, and each time a new item is created, populate this
field with the correct URL. Here's how:

1. In your list  or library, create a new hyperlink field. In my
test, I called it "Workflow". Make sure that this field displays in
your default view.

2. Go to an item in your list, and to the workflows screen, and
right click  on the name of the workflow, to save the URL to your

3. In SP Designer, create a new workflow  that runs each time a new
item is created in your list.

4. Leave the "Conditions" part blank, and in "Actions", we'll have
two actions to take

5. Choose "Build Dynamic String". Paste the URL from your clipboard
in here. In the part of the URL that says "ID=", you'll clear out
the ID number, and add the variable for your the current item's ID
(using the Add Lookup button).
Also, at the end of the URL, you can remove all the end part that
starts with "&source..."
At the end of the URL, after the last "}", type a comma space, and
then type the text that you want to appear in the column for them to
click, such as Start Approval.

6. The next action to add is "Set Field in Current Item". Choose to
set the "Workflow" column to the variable name that you created in
step 5. (Hint: the "source" is workflow data), and the default
variable name will probably be "variable".

THEN, each time a new item is created in this list, this URL will
automatically be populated in the new column!!! users  simply click
the link  to kick off the workflow.

Answer #2    Answered By: Renata Burt     Answered On: Jan 01

I have posted an article on my blog discussing your technique,
hopefully this will help anyone else with a similar problem.


Answer #3    Answered By: Lazaro Rutledge     Answered On: Jan 01

An alternate way of doing this same thing would be:
In SP Designer, convert the list  to XSLT.
Add a new column to the list, and put a hyperlink  field in it.
So, instead of putting the hyperlink in a list using a workflow, you
would add that same hyperlink to the table in SPD.

Didn't find what you were looking for? Find more on Initiate a Workflow from a List View Or get search suggestion and latest updates.