<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get current state of selected custom object C#, please help in Vault Customization Forum</title>
    <link>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7890311#M6394</link>
    <description>&lt;P&gt;Thanks for the quick help psaarloos,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i got it working like this, i case some one else needs this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// &lt;FONT color="#008000" face="Consolas" size="2"&gt;current state in a textbox&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// This is special bacause ist not linked to a property i vault&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (tagValue == &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"TaskCurrentState"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;CustEnt&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; entity = m_mgr.CustomEntityService.GetCustomEntitiesByIds(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;new&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[] { m_objectid }).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// grab information about the lifecycle definition that the item is in&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycDef&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef = m_mgr.LifeCycleService.GetLifeCycleDefinitionsByIds(entity.LfCyc.LfCycDefId.ToSingleArray()).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// create a map of the states so that we can look them up easily.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Dictionary&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycState&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;gt; stateMap = lifeCycleDef.StateArray.ToDictionary(n =&amp;gt; n.Id);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//MessageBox.Show(stateMap[entity.LfCyc.LfCycStateId].DispName);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set the control value to current entity state&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;control.Text = (stateMap[entity.LfCyc.LfCycStateId].DispName);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// &lt;FONT color="#008000" face="Consolas" size="2"&gt;transitions from the current state in a combobox&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (tagValue == &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"TaskNewLifeCycleState"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComboBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; combobox = control &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;as&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComboBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;combobox.Items.Clear();&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;try&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;String&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; FirstComboBoxItem = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;null&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;CustEnt&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; entity = m_mgr.CustomEntityService.GetCustomEntitiesByIds(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;new&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[] { m_objectid }).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// grab information about the lifecycle definition that the item is in&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycDef&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef = m_mgr.LifeCycleService.GetLifeCycleDefinitionsByIds(entity.LfCyc.LfCycDefId.ToSingleArray()).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// create a map of the states so that we can look them up easily.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Dictionary&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycState&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;gt; stateMap = lifeCycleDef.StateArray.ToDictionary(n =&amp;gt; n.Id);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//MessageBox.Show(stateMap[entity.LfCyc.LfCycStateId].DispName);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// Display the value of the current state&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//control.Text = stateMap[entity.LfCyc.LfCycStateId].DispName;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;foreach&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycTrans&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; trans &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef.TransArray)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// figure out the transitions from the current state and add them to the combo box&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (trans.FromId == entity.LfCyc.LfCycStateId)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;TransItem&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; item = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;new&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;TransItem&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(trans, stateMap[trans.ToId]);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;combobox.Items.Add(item);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (FirstComboBoxItem == &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;null&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;FirstComboBoxItem = item.ToString();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set the value in the combobox&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;control.Text = FirstComboBoxItem;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;catch&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Exception&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ex)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;MessageBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(ex.ToString());&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;combobox.Items.Add(&lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"&amp;lt;Select&amp;gt;"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set the value in the combobox&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;control.Text = &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"&amp;lt;Select&amp;gt;"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 10:22:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-03-28T10:22:48Z</dc:date>
    <item>
      <title>Get current state of selected custom object C#, please help</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7889184#M6392</link>
      <description>&lt;P&gt;I have a custom object called task. how do i get the current lifecycle state of the selected custom object, please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The custom object has a lifecycle definition called&lt;/P&gt;&lt;P&gt;Name = Task Process / ID = 10&lt;/P&gt;&lt;P&gt;[Task Process &amp;nbsp;10].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The lifecycle definition [ Task Process 10 ] has these states.&lt;/P&gt;&lt;P&gt;Name =Created / ID = 45&lt;/P&gt;&lt;P&gt;[Created 45]&lt;/P&gt;&lt;P&gt;Name =Assigned / ID = 46&lt;/P&gt;&lt;P&gt;[Assigned 46]&lt;/P&gt;&lt;P&gt;Name =In progress / ID = 47&lt;/P&gt;&lt;P&gt;[In progress 47]&lt;/P&gt;&lt;P&gt;Name =On hold / ID = 48&lt;/P&gt;&lt;P&gt;[On hold 48]&lt;/P&gt;&lt;P&gt;Name =Completed / ID = 49&lt;/P&gt;&lt;P&gt;[Completed 49]&lt;/P&gt;&lt;P&gt;Name =Cancelled / ID = 50&lt;/P&gt;&lt;P&gt;[Cancelled 50]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;string&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; strCustomObjectId = m_objectid.ToString();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Item&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; m_selecteditem = m_mgr.ItemService.GetLatestItemByItemNumber(strCustomObjectId);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// grab information about the lifecycle definition that the item is in&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycDef&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef = m_mgr.LifeCycleService.GetLifeCycleDefinitionsByIds(m_selecteditem.LfCyc.LfCycDefId.ToSingleArray()).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// create a map of the states so that we can look them up easily.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Dictionary&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycState&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;gt; stateMap = lifeCycleDef.StateArray.ToDictionary(n =&amp;gt; n.Id);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// display the value of the current state&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//control.Text = stateMap[m_selecteditem.LfCycStateId].DispName;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;MessageBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(stateMap[m_selecteditem.LfCycStateId].DispName);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;regards kent boettger&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 22:29:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7889184#M6392</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-27T22:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get current state of selected custom object C#, please help</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7889233#M6393</link>
      <description>&lt;P&gt;Hi Kent,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a short sample which hopefully gets you further. I haven't tested it, but I think it should get you where you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private void MyCommandHandler(CommandItemEventArgs e)
{
	// This line should be somewhere else in your extension. In a static class for example.
	SelectionTypeId TaskSelectionType = new SelectionTypeId("SystemNameOfYourCustomEntity");
	
	// verify the event args
	long count = e.Context.CurrentSelectionSet.Count();
	if (e.Context.CurrentSelectionSet == null || count == 0)
		MessageBox.Show("Nothing selected");
	else if (count &amp;gt; 1)
		MessageBox.Show("This operation only works on a single selection");

	ISelection selection = e.Context.CurrentSelectionSet.First();
	
	string entityClassId = null;
	long entityId = -1;
	
	if (selection.TypeId == TaskSelectionType)
	{
		entityClassId = "CUSTENT";
		entityId = selection.Id;

		CustEnt entity = _webServiceManager.CustomEntityService.GetCustomEntitiesByIds(new long[] { entityId }).First()
		
		// Here you can get to the LfCyc object of the entity
		long lifeCycleDefId = entity.LfCyc.LfCycDefId;
		long lifeCycleStateId = entity.LfCyc.LfCycStateId;
		
		// Use the LifeCycleService to get to the Lifecycle Definition object for example
		LfCycDef[] lcDefs = _webServiceManager.LifeCycleService.GetAllLifeCycleDefinitions();

		if (lcDefs == null)
		{
			LfCycDef lifeCycleDefinition = lcDefs.SingleOrDefault(n =&amp;gt; n.Id == lifeCycleDefId);
		}
	}
	else
	{
		MessageBox.Show("This operation does not work with this entity type");
	}
}&lt;/PRE&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 23:10:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7889233#M6393</guid>
      <dc:creator>psaarloos</dc:creator>
      <dc:date>2018-03-27T23:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get current state of selected custom object C#, please help</title>
      <link>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7890311#M6394</link>
      <description>&lt;P&gt;Thanks for the quick help psaarloos,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i got it working like this, i case some one else needs this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// &lt;FONT color="#008000" face="Consolas" size="2"&gt;current state in a textbox&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// This is special bacause ist not linked to a property i vault&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (tagValue == &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"TaskCurrentState"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;CustEnt&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; entity = m_mgr.CustomEntityService.GetCustomEntitiesByIds(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;new&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[] { m_objectid }).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// grab information about the lifecycle definition that the item is in&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycDef&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef = m_mgr.LifeCycleService.GetLifeCycleDefinitionsByIds(entity.LfCyc.LfCycDefId.ToSingleArray()).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// create a map of the states so that we can look them up easily.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Dictionary&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycState&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;gt; stateMap = lifeCycleDef.StateArray.ToDictionary(n =&amp;gt; n.Id);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//MessageBox.Show(stateMap[entity.LfCyc.LfCycStateId].DispName);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set the control value to current entity state&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;control.Text = (stateMap[entity.LfCyc.LfCycStateId].DispName);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// &lt;FONT color="#008000" face="Consolas" size="2"&gt;transitions from the current state in a combobox&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (tagValue == &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"TaskNewLifeCycleState"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComboBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; combobox = control &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;as&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;ComboBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;combobox.Items.Clear();&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;try&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;String&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; FirstComboBoxItem = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;null&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;CustEnt&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; entity = m_mgr.CustomEntityService.GetCustomEntitiesByIds(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;new&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;[] { m_objectid }).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// grab information about the lifecycle definition that the item is in&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycDef&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef = m_mgr.LifeCycleService.GetLifeCycleDefinitionsByIds(entity.LfCyc.LfCycDefId.ToSingleArray()).First();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// create a map of the states so that we can look them up easily.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Dictionary&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;long&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycState&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;&amp;gt; stateMap = lifeCycleDef.StateArray.ToDictionary(n =&amp;gt; n.Id);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//MessageBox.Show(stateMap[entity.LfCyc.LfCycStateId].DispName);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// Display the value of the current state&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;//control.Text = stateMap[entity.LfCyc.LfCycStateId].DispName;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;foreach&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;LfCycTrans&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; trans &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;in&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; lifeCycleDef.TransArray)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// figure out the transitions from the current state and add them to the combo box&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (trans.FromId == entity.LfCyc.LfCycStateId)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;TransItem&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; item = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;new&lt;/FONT&gt; &lt;FONT color="#2b91af" face="Consolas" size="2"&gt;TransItem&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;(trans, stateMap[trans.ToId]);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;combobox.Items.Add(item);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (FirstComboBoxItem == &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;null&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;FirstComboBoxItem = item.ToString();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set the value in the combobox&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;control.Text = FirstComboBoxItem;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Consolas" size="2"&gt;catch&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; (&lt;/FONT&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;Exception&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; ex)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;FONT color="#2b91af" face="Consolas" size="2"&gt;MessageBox&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;.Show(ex.ToString());&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;combobox.Items.Add(&lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"&amp;lt;Select&amp;gt;"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Consolas" size="2"&gt;// set the value in the combobox&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;control.Text = &lt;/FONT&gt;&lt;FONT color="#a31515" face="Consolas" size="2"&gt;"&amp;lt;Select&amp;gt;"&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 10:22:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vault-customization-forum/get-current-state-of-selected-custom-object-c-please-help/m-p/7890311#M6394</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-28T10:22:48Z</dc:date>
    </item>
  </channel>
</rss>

