Recent searches


No recent searches

error "Invalid conditions.Error: "You must select at least one condition." when attempting to create a view via the API using Zapier

Answered


Posted Apr 19, 2022

Hello! I'm hitting the error "Invalid conditions. You must select at least one condition." when I attempt to create a view via the API using Zapier.

However, i THINK i have a correctly formatted "All" condition for "Status."

Any thoughts on where I'm going wrong?

 


0

9

9 comments

image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi Matt! I took a look at the logs for these requests and there is a lot of formatting coming over with these requests, which is causing the payload to be unprocessable. If this is being copy/pasted from somewhere else, I would recommend trying this by holding the Shift key when pasting this, which will send only the text, without any formatting. 

Let me know if this resolves it for you!

0


Thanks Greg! I'm still running into the same issue after stripping the formatting from the text. Any other thoughts? Any details about the formatting you're seeing that might be a clue?

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

Yeah, I can see that's still coming up as an issue for you. The payload is coming through formatted like this with a bunch of newlines: 
 
{"{\n    \"view\": {\n      \"title\": \"Zapier Test View\",\n      \"description\": \"Zapier Test View\",\n      \"active\": true,\n      \"position\": 3\n       },\n      \"all\": "=>{"\n        {\n          \"field\": \"status\",\n          \"operator\": \"less_than\",\n          \"value\": \"solved\"\n        },\n        {\n       \"field\": \"current_tags\", \n       \"operator\": \"includes\", \n       \"value\": \"zapier_test\"\n       }\n      "=>{",\n      \"output\": {\n        \"columns\": "=>{"\"status\", \"requester\", \"assignee\""=>{",\n        \"group_by\": \"assignee\",\n        \"group_order\": \"desc\",\n        \"sort_by\": \"status\",\n        \"sort_order\": \"desc\"\n      }\n    }"=>nil}}}}}
 
I would try the same through Postman or curl and see if the issue persists from there. If it doesn't, I would reach out to Zapier and see if they're doing any html desanitization that might be causing these issues. If it doesn't work through Postman or curl, let me know and we can figure out our next steps here!

0


Thanks again Greg. I'm still getting the same response through Postman, even when sending it explicitly as text:

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

Hey Matt, I'm actually seeing the same thing in my test account. I cleaned up the payload that you were using, but I'm getting exactly the same error even after it's cleaned up, so it's not the newlines that are necessarily causing this problem. I'm going to keep investigating this and I'll keep you updated when I figure it out.

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

Ah, I figured it out! Not sure how I missed this, but I blame JSON syntax being not that obvious. The issue was that the "views" object was being closed after "position": 3, which effectively closes off the payload. Since it was ending the payload before "all", we were receiving the error that said "you must select at least one condition." I cleaned it up for you here and tested this in my account and it created it appropriately. I would recommend using shift + paste when putting this into Zapier to ensure that any formatting from our code editors doesn't cause any more issues for you. Let me know if this works!
 
{
"view": {
"title": "Zapier Test View",
"description": "Zapier Test View",
"active": true,
"position": 3,

"all": [
{ "field": "status", "operator": "less_than", "value": "solved" },
{
"field": "current_tags",
"operator": "includes",
"value": "zapier_test"
}
],
"output": {
"columns": ["status", "requester", "assignee"],
"group_by": "assignee",
"group_order": "desc",
"sort_by": "status",
"sort_order": "desc"
}
}
}

0


Great catch! But i'm STILL seeing that same error. Do you see anything different in the latest logs?

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

I'm still seeing it coming through with the newline breaks in the formatting. Could you try this again from Postman? It looks like the recent attempts were all done through Zapier, so that would help confirm or deny that. If it's happening in Postman as well, do you have a different machine or account on that machine that you could try from? 

0


image avatar

Greg Katechis

Zendesk Developer Advocacy

One more quick update...I checked the logs and the formatting issue isn't present when you made the requests from Postman. I'm certain that Postman will work for you, so I would reach out to Zapier to understand why they are adding all of the newline characters in their editor. I haven't found examples of other customers running into the same problem from Zapier, which isn't a helpful troubleshooting note, except for the fact that it doesn't seem to be a widespread issue.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post