Post

2 followers Follow
0
Avatar

CZQL for Risks and Issues. Error given with 'WHERE EntityType = "Risk"

I'm trying to create a CZQL string to find all risks and Issues. 

I'm not sure if I'm doing it incorrectly or whether there is a bug. I've tried the following but all return an error.

Interesting results with the first one. If I just did "SELECT Title, EntityType FROM Case", this returns results with the field name EntityType however when I use EntityType in the WHERE statement, it doesn't work. 

SELECT Title, EntityType FROM Case WHERE EntityType = "Risk" OR EntityType = "Issue"

Results: 

{
"errorCode": "General",
"message": "Can not convert value 'Risk' to type 'Entity' (Field name: 'EntityType')",
"referenceId": "2CHU6M9jLKOb0K58JOEcKt"
}

SELECT Title, EntityType FROM Case WHERE EntityType IN ('Risk', 'Issue')

Results: 

{
"errorCode": "MissingArgument",
"message": "Missing argument: typeName",
"referenceId": "3wVmrH9Q8JjHBVUskO812e"
}

 

SELECT Title, EntityType FROM Case WHERE typeName IN ('Risk', 'Issue')

Results: 

{
"errorCode": "InvalidField",
"message": "Entity 'Case' does not contain the field 'typeName'",
"referenceId": "2ASpeMz25Q04RDlUs0N4Xz"
}

 

Darren Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Chris.

You cannot use EntityType for a query filter. There are other ways you can go:

  1. Query each type (i.e. Issue/Risk) separately.
  2. Use the SYSID field (i.e. SYSID like 'I-%' for issues, SYSID like 'R-%' for risks).
  3. Filter out other case types within some post processing in your code.

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink