Solved

Insert variable into web service call

  • 9 October 2018
  • 1 reply
  • 5 views

Userlevel 6
Badge +12

Hello all - 

 

I am attempting to call some web services to automate the update of chat bots and have been successful, but am wondering if there is a better, more streamlined way to do it. I am unable to insert variables into the request body and have to split everything up. I have tried using the Build String action as well as a Dictionary, both come through as empty.

 

Build String Action:

219438_pastedImage_3.png

 

Dictionary Action:

219439_pastedImage_4.png

Result in wf:

219440_pastedImage_5.png

 

For now I am doing something like this:

var_body1{"startData": {"se_title": "

var_body2 = ","se_answer": "

var_body3 = "}}

 

So then I insert all 5 variables...

{Variable:var_body1}{CurrentItem:Title}{Variable:var_body2}{CurrentItem:Answer}{Variable:var_body3}

 

This works, but why do I have to jump through this many variables just to construct the body of a web service call? Imagine if I needed to insert 5 variables? 10? You see where I am going with this....

 

 

Is there something that I am overlooking in my syntax or something more "Nintex" specific" that I have to incorporate?

I was able to do this in NWC (with no issues), but if I attempt to hit the NWC end-point that I created, I run into the same issues (as I need to pass variables in the start data).

 

Thanks!

icon

Best answer by callum 12 October 2018, 06:46

View original

1 reply

Badge +9

Hi Jesse,

Regarding the formatting of the data there, I think what you're running into is the native SharePoint 2013 Workflow engine's way of dealing with curly braces, in a string the engine will use curly braces to identify areas to be replaced in a string.

I believe if you format your payload more

{{ "startData" : "abc" }} 

using double quotes, the engine will ignore them. Unfortunately it's a bit of bad play between the HTML editor and the workflow engine.

With that in mind, it looks like you're trying to start an NWC workflow with that payload, there's actually a full featured action we have for that which will take away all the payload/formatting stuff and discover the fields you need.: Start Workflow in Nintex Workflow Cloud

If you grab the OpenAPI spec from the Workflow Cloud workflow in the API dialog

Then just paste it into the O365 action Start Workflow in Nintex Workflow Cloud

It will connect and render the appropriate fields for the appropriate data types.

Hope both these help,

Callum

Reply