cbeene
Apprentice

How to launch a WorkFlow from a form button.

I'm looking for a definitive guide to launch a WF from a button in a form.  I'm have viewed a few post showing how to do it with JavaScript but the instructions are not clear enough for a non-JS user.  Can anyone point me to a post or create that post here showing what generic code I would need and what parts of the code need to be customized in what way?

Specifically, I will have a list of projects in process.  The form for each line item is a project "command center" for that line item.  There are various form based sub-processes that I would like to be able to run from this command center form and I would like to be able to launch the WF directly. 

Reply
10 Replies
TomaszPoszytek

Re: How to launch a WorkFlow from a form button.

It's not that straightforward, you would need to hide some JavaScript/ CSOM/ JSOM code behind. The easiest way to find out how to call a workflow is to use to find out what URLs and what headers are sent once you manually click the link to start a workflow.

This communication is described in ‌'s post: https://community.nintex.com/community/tech-blog/blog/2017/01/18/stronger-together-nintex-workflow-c... about firing an Nintex O365 workflow from the Nintex Workflow Cloud. Although if you want to fire it from the same environment you don't need to authenticate your code first, the other steps are imho what you're looking for.

Oh, and one thing - I did the homework and I can confirm, looking at fiddler log, that this communication is done that way and yes - I was able to successfully trigger a workflow using those requests.

 Regards,

 Tomasz

Reply
cbeene
Apprentice

Re: How to launch a WorkFlow from a form button.

Thomasz, what method did you use to trigger the WF with this data?  JavaScript, a Nintex action, etc?  I'm a newbie to this side of Nintex so learning as I go.

Reply
TomaszPoszytek

Re: How to launch a WorkFlow from a form button.

I did try using it with the application as well from the Nintex Workflow Cloud.

I suppose it's pretty easy when using Nintex O365 workflow actions to follow those steps as well.

However, based what I understand you would like to achieve, you should use a JavaScript action that is being executed when clicking the button on your form.

Another thing to remember - Nintex O365 Form is being working under a different domain than your tenant, so if you will want to trigger a workflow following that steps you will probably need (I am almost sure you will need) to add an authorization header to your request. It can be either accessToken as mentioned in that post, or you can try to add a "Cookie" header attribute with values of FedAuth and rtFa cookies (how to obtain them: https://community.nintex.com/community/build-your-own/nintex-for-office-365/blog/2017/02/09/working-...).

I think you should try to simulate, in your JS script, steps 5 to 8 from the Kok Koon Gan's post. You can just the 8th step, but you need to manually obtain the "SubscriptionID".

Regards,

Tomasz

Reply
cbeene
Apprentice

Re: How to launch a WorkFlow from a form button.

Tomasz,

thanks for the info, but I cannot make heads or tails of what you are telling me and how to apply it to Kok Koon Gan's post. I'm getting better at Nintex Workflow, but have no experience in JS.  I was hoping someone would say "Here's the code I used and here's the items you have to update to make it work."  

It seems that Nintex would be able to greatly be able to improve functionality and customization by offering a "Start a WF" button.  

Reply
pwarrak
Novice

Re: How to launch a WorkFlow from a form button.

Dear, 

Please check this post for vadim tabakman:

Nintex Forms - Starting a Workflow and Waiting - Vadim Tabakman

If you need any help let me know, since I already tested it.

Regards,

Philip

Reply
TomaszPoszytek

Re: How to launch a WorkFlow from a form button.

I'm not sure but something tells me that solution is not going to work  in O365... But of course it's worth trying

0 Kudos
Reply
pwarrak
Novice

Re: How to launch a WorkFlow from a form button.

 
Curtis Beene didn't mention O365 in his question.

I tried it on prem only .

It will not work in O365 since it's client SOAP call not REST/OData.

0 Kudos
Reply
TomaszPoszytek

Re: How to launch a WorkFlow from a form button.

Shouldn't have to, question is posted in O365 forum

SOAP web service endpoints are also available in O365. I was rather thinking about Nintex for O365 architecture that could prevent it, but I am not sure.

 Regards,

 Tomasz

0 Kudos
Reply
cbeene
Apprentice

Re: How to launch a WorkFlow from a form button.

Philip/Tomasz, 

Thank you for your replies. I did see Vadim's post but, as Tomasz pointed out, I am working in O365.  

Tomasz,

I will do a little research into your post in the next day or two and, I'm sure, come back with a few questions.  

0 Kudos
Reply