Skip to main content

Hi everybody, 

I have a business request, to start a site workflow by a button. This workflow should then start a site workflow IN THE USER's CONTEXT!!! that clicks the button, without popping up the site workflow's start form directly (that's important for the further processing).
So I thought about the SOAP web service. 
Found a little script to get the user logon name (GetCurrentUser.js). Then I used a script to call the web service, I found here on Connect forum (StartSiteWorkflow) and adopted it to my needs. 

This I call with a button like this: 

<script type="text/javascript" src="/sites/sdtools/odfbreq/SiteAssets/StartSiteWorkflow.js"></script>
<script type="text/javascript" src="/sites/sdtools/odfbreq/SiteAssets/GetCurrentUser.js"></script>
<input type="Button" value="ShowMyUserName" onclick="GetCurrentUser();"/>

Inside the workflow I created a variable "inUserLogon" (Single Line of Text, not shown on start form, not required) where I try to pass the value from my script to the workflow by web service association data - that's the point I'm struggling and ended up now after spending hours on this.

When I activate the alert(data) tag in the StartSiteWorkflow script I can see, that the variable is filled correctly. 

198919_pastedImage_1.png

In the workflow I added a send notification action and there the variable "inUserLogon" is empty / blank. 

So the hand over from the script to the workflow must fail. I tried with and without XML encoding (both ways don't throw an error) and start the workflow but with the blank variable.

Any help would be highly appreciated!

Thanks and BR, Rubi

workflow only accepts to input values for variables with 'shown on start form', so you have to enable it make the input pass through


Thanks for your input, but it still doesn't work. I also tried this before, but no way to pass the variable in there works for me.
199463_pastedImage_3.png

Directly after workflow start I implemented a send notification action with the variable value and this returns blank.


1. check documentation for proper format of association data   http://help.nintex.com/en-US/sdks/sdk2013/#Reference/SOAP/NW_REF_SOAP_StartWorkflowOnListItem.htm?Highlight=AssociationD… 

you eg. miss namespaces for some elements, data being pass through should be encoded ...

2. use rather standard window.encodeURIComponent() function to encode data instead of writing own one, you need even not realize that some characters need to be encoded


First of all: I'm a newbie in development and really appreciate your help. 
I've implemented the encoding and additional namespace but even the encoded string changed no, it still doesn't work.

199464_pastedImage_4.png

data = window.encodeURIComponent(data); 

...

 "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:nin=""http://nintex.com"">"

What else am I missing? I really don't find the cause for my problem.


I'm sorry I was wrong with encode function name, use rather window.ULSEncodeXML()

next check correct syntax of the request on the link I provided, including case sensitivity. you seem to use eg, AssociationData with capital 'A' which is not correct.


Thanks a lot - my Problem was in the end, that I used <Association with a capital letter in the data section, but it seems to be case sensitive.

Now it works like a charm ;-)


excellent!

if you have resolved your problem, mark the question answered.


Reply