There may be a more elegant solution, but what about having the java script button create a List Item in a SharePoint list, which has a workflow on it to start the site workflow when a new item is created?
That could work, how would I go about implementing that?
Should be something like this (button starting site workflow) :
<script>
var dlg = null;
function startWorkflowYearlyArchive()
{
try
{
showInProgressDialog();
var ctx = SP.ClientContext.get_current();
var wfManager = SP.WorkflowServices.WorkflowServicesManager.newObject(ctx, ctx.get_web());
var subscription = wfManager.getWorkflowSubscriptionService().getSubscription("IDOFYOURWORKFLOW");
ctx.load(subscription, 'PropertyDefinitions');
ctx.executeQueryAsync(
function(sender, args)
{
wfManager.getWorkflowInstanceService().startWorkflow(subscription, "");
ctx.executeQueryAsync(
function(sender, args)
{
closeInProgressDialog();
},
function (sender, args)
{
closeInProgressDialog();
alert(errorMessage);
});
});
}
catch(ex)
{
alert(ex);
dlg.close();
}
}
function closeInProgressDialog()
{
if(dlg != null)
{
dlg.close();
}
}
function showInProgressDialog()
{
if(dlg == null)
{
dlg = SP.UI.ModalDialog.showWaitScreenWithNoClose("Waiting...", "Shouldn't take long", null, null);
}
}
</script>
<p>
<a onClick="javascript:startWorkflowYearlyArchive()" style="cursor: pointer;">MESSAGE</a>
</p>
Hey Thomas, thanks for your reply! I'm not great with Javascript, can you point out where in your code I need to set my own parameters (workflow name, etc)?