Sharepoint Drop Down Context Menu Workflow Shortcut

It’s fairly simple to add custom menu options to the drop down context menu in sharepoint library/list views. One useful example maybe to provide a shortcut to start workflows, instead of opening the workflow page; selecting the desired workflow and clicking the Start button.

To do this we need to add some Javascript to the page. Edit the page and add a Content Editor Web Part, hide it by clearing its Layout / Visible on Page checkbox. Edit the Content Editor Web Part Source and insert the following Javascript:

<script language="javascript">

function Custom_AddDocLibMenuItems(m, ctx)
{
var strDisplayText = "Send for Review";
var strAction = "http://sharepointserver/Workflows/Send%20for%20Review/Send%20for%20Review.aspx?List=14987b66-90be-4693-aafd-94bc6ba8f18e&amp;ID=24&amp;TemplateID={dcbbce95-46dc-4b58-b69e-a99b9ea6a698}&amp;Source=http%3A%2F%2Fsharepoint%2Edomain%2Ecom%2FWIP%2FForms%2FOpen%2Easpx%3FPageView%3DShared";

var strImagePath = "";

var start = strAction.indexOf("&amp;ID=")+4
var prefix = strAction.substr(0, start)
var suffix = strAction.substr(strAction.indexOf("&amp;", start), strAction.length)

strAction = "location.href = '" + prefix + currentItemID + suffix + "'"

// Add our new menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);

// add a separator to the menu
CAMSep(m);

return false;
}
</script>

If you update the workflow you will need to edit the strAction property as the URL will change. Also if you try to start a workflow using the shortcut on an item where the workflow is already running the workflow will error. If there is a way to check if workflow is running on an item I’d be interested to know how it’s done!

2 comments:

BeerThirty.com said...

I have been trying, unsuccessfully, to get this implemented. I add it, and change the URL to a workflow start, but it shows nothing on the page. Thoughts?

lti5y2gii8 said...

These types of free slots are nice for Funsters who're out-and-about, and looking for a enjoyable approach to move the time. Every single recreation supplied on this site may be played using a cellular device. This consists of iPhones, iPads and devices running on the Android operating system. Mobile players should merely entry our site using their browser and select the sport they want to play. No, there is no a|there isn't any} need to download any software program when enjoying in} free games. Instead, you'll be 카지노사이트 able to|you presumably can} play them via your desktop or cellular browser.