- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a custom object called task. how do i get the current lifecycle state of the selected custom object, please help.
The custom object has a lifecycle definition called
Name = Task Process / ID = 10
[Task Process 10].
The lifecycle definition [ Task Process 10 ] has these states.
Name =Created / ID = 45
[Created 45]
Name =Assigned / ID = 46
[Assigned 46]
Name =In progress / ID = 47
[In progress 47]
Name =On hold / ID = 48
[On hold 48]
Name =Completed / ID = 49
[Completed 49]
Name =Cancelled / ID = 50
[Cancelled 50]
i have found this code but is't for a item, and i can't figure out how to rewrite this for a custom object.
string strCustomObjectId = m_objectid.ToString();
Item m_selecteditem = m_mgr.ItemService.GetLatestItemByItemNumber(strCustomObjectId);
// grab information about the lifecycle definition that the item is in
LfCycDef lifeCycleDef = m_mgr.LifeCycleService.GetLifeCycleDefinitionsByIds(m_selecteditem.LfCyc.LfCycDefId.ToSingleArray()).First();
// create a map of the states so that we can look them up easily.
Dictionary<long, LfCycState> stateMap = lifeCycleDef.StateArray.ToDictionary(n => n.Id);
// display the value of the current state
//control.Text = stateMap[m_selecteditem.LfCycStateId].DispName;
MessageBox.Show(stateMap[m_selecteditem.LfCycStateId].DispName);
regards kent boettger
Solved! Go to Solution.

