cancel
Showing results for 
Search instead for 
Did you mean: 
courtney_shelto
Nintex Newbie

How to create a button that starts a site workflow in O365?

I've browsed a ton of threads on here about creating a button to start a list workflow, but not a site one in O365. When I go to the Site Workflows area and copy the URL of starting the workflow I want, I get this Javascript:

javascriptSmiley FrustratedtartWorkflow4('26220e76-0c13-4c07-8763-4f51589b57cf', '', '')

I can't figure out how to basically build a URL or a button to start this darn site workflow. I am not looking to put this on a Nintex Form, just on the page.

Labels: (1)
Reply
4 Replies
Highlighted
brentless
Nintex Newbie

Re: How to create a button that starts a site workflow in O365?

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?

Reply
courtney_shelto
Nintex Newbie

Re: How to create a button that starts a site workflow in O365?

That could work, how would I go about implementing that?

0 Kudos
Reply
tbeduneau
Nintex Newbie

Re: How to create a button that starts a site workflow in O365?

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>

0 Kudos
Reply
courtney_shelto
Nintex Newbie

Re: How to create a button that starts a site workflow in O365?

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)?

0 Kudos
Reply