title: Start a workflow from a custom button/action on a list item in SharePoint 2010 (all with Visual Studio 2010)
body: <p>I'm sorry for asking a double question, but I'm messed up with finding no solution - or a missing understanding of answers.</p>
  
  <p>My problem is like descrided:</p>
  
  <p>I have some self constructed custom ribbons with buttons. And I like to start a workflow if I click on designed button.</p>
  
  <p>Okay, more about settings:</p>
  
  <p>It is a generic list, means, my elemets.xml looks like that:</p>
  
  <pre><code>&lt;CustomAction
    Id="MyCustomRibbonTab"
    Location="CommandUI.Ribbon.ListView"
    RegistrationId="100"
    RegistrationType="List"&gt;
    &lt;CommandUIExtension&gt;
      &lt;CommandUIDefintions&gt;
        &lt;CommandUIDefinition
          Location="Ribbon.Tabs._children"&gt;
          &lt;Tab Id="Ribbon.CustomTab" Sequence="501"&gt;
          ... (Scaling)
            &lt;Groups Id="Ribbon.CustomTab.Groups"&gt;
              &lt;Group 
                Id="Ribbon.CustomTab.GroupOne" 
                Sequence="52"&gt;
                &lt;Controls Id="Ribbon.CustomTab.GroupOne.Controls"&gt;
                  &lt;Button
                    Id="Ribbon.CustomTab.GroupOne.ButtonOne"
                    Command="CustomTab.ButtonOneCommand"
                    Sequence="11"&gt;
                &lt;/Controls&gt;
              &lt;/Group&gt;
            &lt;/Groups&gt;
          &lt;/Tab&gt;
        &lt;/CommandUIDefinition&gt;
      &lt;/CommandUIDefinitions&gt;
      &lt;CommandUIHandlers&gt;
        &lt;CommandUIHandler
          Command="CustomTab.ButtonOneCommand"
          CommandAction="javascript:alert('how start workflow here?');" /&gt;
          /&gt;
      &lt;/CommandUIHandlers&gt;
    &lt;/CommandUIExtension&gt;
    &lt;!-- what about starting workflow here? How? --&gt;
  &lt;/CustomAction&gt;
  </code></pre>
  
  <p>Hope it is clear what my XML-Post means. Okay, that works fine if I put CommandAction="javascript:alert('should start a workflow');" . I mean, this alert pops up and I can click okay, nothing else. </p>
  
  <p>Now I have in same project my workflow designed. There are two types, one with initiation form in asp, the other without, both operating on selected item. I can start them while using the standard ribbon "Workflows" and then click them. Everything is fine so far. </p>
  
  <p>But I want to start each workflow by clicking my button, not having more clicks as it is now. Thank you so far in helping me.</p>
  
  <p>I'm very new on SharePoint. So please include in your answer stuff like "Add new ... Empty Element/ JavaScript File" or whatever is neccessary to get what I assume.</p>
  
  <p>If you have more questions about my workflow design, I will answer asap.</p>
  
  <p>Thank you very much,</p>
  
  <p>danbruc</p>
  
  <p>Note: Yes, I just hope that even my Elements.xml is fine. I took all from web. So if yuo have suggestions to redesign, I am open minded. Just blind in seeing the solution. 
   Additionally, I'm able to put this Tab inside ContextualTab of ListView, but then even javascript is not working.</p>