Post

2 followers Follow
0
Avatar

Invalid Operation Error

Hi,

I am making an HTTP Post request to URL /bulk/execute for simple query on RecurringTask object with the request payload:

{
 "requests": [
  {
   "url": "\/data\/query",
   "method": "POST",
   "body": "{\"q\":\"SELECT ActiveStopwatch, ActualBilledExpenses, Country FROM RecurringTask WHERE CreatedBy like '%a%' LIMIT 10 OFFSET 0\"}"
  }
 ]
}

The response that I am having in return is :

{
 "responses": [
  {
   "statusCode": 500,
   "body": {
    "errorCode": "InvalidOperation",
    "message": "Invalid operation: Operation 'Like' is incompatible with field 'CreatedBy' of 'ObjectIdentifier' data type",
    "referenceId": "3w6OTUkwDV8lxlWusLsVso"
   },
   "headers": [

   ]
  }
 ]
}

Can anyone point me out if there is any wrong with the request payload, or how I can avoid this error altogether.

Thanks in advance!

Jeet Prakash Answered

Official comment

Avatar

Hi Jeet,

Conditions on nested fields are not valid in CZQL so the above query will fail. However, it can be rewritten using an IN condition and achieve the same results:

{
"q":"SELECT ActiveStopwatch, ActualBilledExpenses, Country FROM RecurringTask WHERE CreatedBy IN (
select ID FROM User WHERE Name like '%a%' )
LIMIT 10 OFFSET 0"
}

 

I hope this helps,

Elad

Elad Franklin
Comment actions Permalink

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Elad,

Many thanks for the quick response, and the query you suggested is working!!

Thanks again!

Jeet Prakash 0 votes
Comment actions Permalink