Ad-hoc query "Invalid Query Type"

I'm getting this error:

"title": "One or more validation errors occurred.",

"status": 400,

"detail": "Invalid query type.",

This is my query definition. Would someone please tell me what's wrong with it? (RE NXT).

Thank you!

Lisa.

{

"query": {

"select_fields": [

{

"query_field_id": 425

}

],

"filter_fields": [

{

"query_field_id": 130551,

"compare_type": "And",

"filter_values": [

"100000"

],

"operator": "GreaterThanOrEqualTo",

"left_parenthesis": false,

"right_parenthesis": false,

"summary_instance": 2

}

],

"sort_fields": [],

"type_id": 20,

"sql_generation_mode": "Query",

"gift_processing_options": {

"soft_credit_option": "Donor",

"matching_gift_credit_option": "MatchingGiftCompany",

"use_gross_amount_for_covenants": false

},

"advanced_processing_options": {

"use_alternate_sql_code_table_fields": false,

"use_alternate_sql_multiple_attributes": false

},

"suppress_duplicates": true,

"constituent_filters": {

"include_inactive": false,

"include_deceased": false,

"include_no_valid_addresses": true

}

},

"ux_mode": "Asynchronous",

"formatting_mode": "None"

}

Best Answer

  • Lisa Peoples
    Answer ✓

    Hi Alex, my pending query finally finished!

    I will modify the order of the filters to see if it goes faster.

    I don't have filter fields on the summary field because I just wanted the life time total gifts.

    Thank you for all your help. Copying the json directly was what worked in the end.

Answers

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Facilitator 5 Kudos 5 bbcon 2025 Attendee Badge

    query type id 20 is gift query, which doesn't have summary field.

    summary field is usually constituent query and that's type 18.

    So the question is, how did you "constructed" the query, did you copied from the webview query module "Copy JSON" button, and if you modified it somehow. What are you trying to query on?

  • Sorry Alex, you are right, I did have type 18, and changed it to 20 to see if it worked. It fails both ways. You're right about gift type 20 not having the summary field. Unfortunately that's not my issue. I put it back to type 18.

    I did use the copy json button and modified it using your instructions from another post.

  • Alex I changed the filter to just have date (tried MM/DD/YYY and YYYY-MM-DD) to see if the summary field was causing trouble. I am still getting the error: (thank you)

    {

    "query": {

    "select_fields": [

    {

    "query_field_id": 425

    }

    ],

    "filter_fields": [

    {

    "query_field_id": 68586,

    "compare_type": "And",

    "filter_values": [

    "2026-05-01"

    ],

    "operator": "GreaterThanOrEqualTo",

    "left_parenthesis": false,

    "right_parenthesis": false

    }

    ],

    "sort_fields": [],

    "type_id": 18,

    "sql_generation_mode": "Query",

    "gift_processing_options": {

    "soft_credit_option": "Donor",

    "matching_gift_credit_option": "MatchingGiftCompany",

    "use_gross_amount_for_covenants": false

    },

    "advanced_processing_options": {

    "use_alternate_sql_code_table_fields": false,

    "use_alternate_sql_multiple_attributes": false

    },

    "suppress_duplicates": true,

    "constituent_filters": {

    "include_inactive": false,

    "include_deceased": false,

    "include_no_valid_addresses": true

    }

    },

    "ux_mode": "Asynchronous",

    "formatting_mode": "None"

    }

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Facilitator 5 Kudos 5 bbcon 2025 Attendee Badge

    you have modified/removed more than you should.

    I'm also not sure which post you were following, as there were some changes that made getting Query JSON definition easier directly from the query webview.

    So my suggestion is, go to RE NXT query webview, and create the query (you don't need to save it) filter, output again, then in the Option tab, Copy JSON button.

  • Lisa Peoples
    edited May 13

    This actually works but stays pending forever (if I copy the whole json in). I read somewhere that there is too much in this and you had to strip some of it out - use GET Query and change the IDs to _ID and encapsulate it in a Start and some end stuff. Which is what have tried.

    I've started it running with the whole query json, but this will still be pending in a few days…

    image.png

    Any suggestions? Thank you for your time.

  • Alex Wong
    Alex Wong Community All-Star
    Tenth Anniversary Facilitator 5 Kudos 5 bbcon 2025 Attendee Badge

    generally, "not one of" is more "taxing" on the querying, but should still not take days.

    Pending status also means the job didn't even start the run yet.

    Can you screenshot and paste the actions in PA flow?

    Also, your query is using a summary field (total amount of gifts), which your summary_fields property is empty, that should not be the case. Are you sure the txt file you attached is directly from the Copy JSON in the query without any modification?

    image.png image.png

Categories