SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a custom list (PBE) and attached a workflow which creates a task. When I edit the task, I am in my custom task form (.aspx)

I want to check a value in a field in my orginal custom list (pbe). The url passed to the custom task form has several parameters, but I think list = task list. In ID parameter I can see the original list guid.

Is it possible to retrieve the orginal PBE data through the task list or do I need to edit the url ID field, saying this I dont have a reference to the item itself ?

I'm coding in c# and using Visual Studio.

share|improve this question

You can retrieve item from workflow properties and set IDs of PBE item and list to extended properties of task

taskProperties.ExtendedProperties["ItemId"] = item.ID;
taskProperties.ExtendedProperties["ItemListId"] = item.ParentList.ID;

Then you can retrieve these values in your custom task form like this

Hashtable extendedProperties = SPWorkflowTask.GetExtendedPropertiesAsHashtable(task);
var listId = extendedProperties["ItemListId"];
var itemId = extendedProperties["ItemId"];

You can access to the field like this

var list = web.Lists[listId];
var item = list.GetItemById(itemId);
var fieldValue = item[fieldId];
share|improve this answer
Hi Thanks for this information, In my Custom Task Form I now have the two variables. listId and itemId. How Can I grab a field in the list with a certain ID ? – Raj Chahal Jan 4 '12 at 15:35
I updated my answer. If you want to get field, not a value of field, you can use list.Fields[fieldId] method. – Alexander Jan 4 '12 at 16:00
HI I accessed the fields like this, though it works its more complex, have I done it the long way ? this._sharePointListAttachedTo1 = this._myTeamSite.Lists[new Guid(listId)]; this._listItemObject1 = this._sharePointListAttachedTo1.GetItemById(Convert.ToInt32(itemId)); Label5.Text = Convert.ToString(_listItemObject1["AT pbe entry user"]); – Raj Chahal Jan 4 '12 at 20:19
Wheres a good place to learn about these classes and methods ? Not too keen on the msdn site.. – Raj Chahal Jan 4 '12 at 20:25
I know only one site for this. it is a ;) – Alexander Jan 4 '12 at 20:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.