cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cannot use a variable in a Web Request action body

Jump to solution

I'm using Nintex for O365 to create a simple workflow that posts to a Web Service using the Web Request action.  I use string builder actions to build my JSON object in a variable, but when I use the variable in the body of my request I get an error returned stating "Request JSON object for insert cannot be null".

I've emailed the variable's value to myself and logged it to the history list, confirming that the variable has the correct value when I submit, and I can copy and paste the text into the request body and it works fine, just not when I actually use the variable as the request body.  It almost seems like the variable is not encoded in a way the action can understand.

Has anyone else run across this problem?  Thanks.

Tags (2)
0 Kudos
Reply
4 Replies
Community Manager Community Manager
Community Manager

Re: Cannot use a variable in a Web Request action body

Jump to solution

Adam,

I'm looking into this and will update if I find out anything.

0 Kudos
Reply
Automation Master
Automation Master

Re: Cannot use a variable in a Web Request action body

Jump to solution

Hi Adam,

I think that it's a bug because I have the exact same behaviour.

I've found a workaround explained in this discussion:

https://community.nintex.com/message/34390#comment-34390

Tell me if it's not clear

0 Kudos
Reply
Not applicable

Re: Cannot use a variable in a Web Request action body

Jump to solution

Thanks Caroline.  It looks pretty clear.  I'll give it a try and let you know if it works for me.

0 Kudos
Reply
Community Manager Community Manager
Community Manager

Re: Cannot use a variable in a Web Request action body

Jump to solution

Adam,

I figured out a solution. 

Step 1:Create variables as plain text or strings and set your data from the SharePoint item to that.

Step 2: Build your json call using the build string action and pull in your workflow variables into that string

Step 3: In the Web Request, pull in the one string variable that contains your json code

This should work well.  I am working on a similar solution which will be out shortly and as soon as I finish it I will share some code and info.

The biggest thing on this in my case was to ensure the json was formatted correctly to not throw an error on the web request.

Eric

0 Kudos
Reply