1

I'm having an issue with an Or condition in my graphql statement. It returns all orders where the Order_Status__c field is 'Quote', but not 'Waitlisted'. There are no errors, just the additional data is not returned. I've looked at graphQl examples and what I have seems to be correct. If I remove the contition for 'Quote', Waitlitsted orders are returned by the query. The query seems to stop after retrieving 8 records, even though there are additional records that are of either status. Any ideas?

    query: gql`
    query ordersByProgramDateId($orderId: ID, $programDateId: ID) {
        uiapi {
          query {
            Order__c(
                where: {
                and: [
                  { Id: { ne: $orderId } }
                  { Program_Date__c: { eq: $programDateId } }
                  { or: [
                    { Order_Status__c: { eq: "Quote" } } 
                    { Order_Status__c: { eq: "Waitlisted" } }  // this isn't used for some reason
                  ]}
                ]
              },
              orderBy: { Name: { order: ASC }}
            ) {
              edges {
                node {
                  Id
                  Name {
                    value
                  }
                  Order_Status__c { value }
                  Account__r { Name { value } }
                  Linked_Order__r { Name { value } }
                  Order_Lines__r ( where: {
                                    and: [
                                      { Order_Line_Type__c: { eq: "Accommodation"}} 
                                      { or: [
                                                  {Order_Line_Status__c: { eq: "Open" }},
                                                  {Order_Line_Status__c: { eq: "Confirmed" }}
                                                  ]}
                                      ]
                                  },
                                  orderBy: { Contact_Name__c: { order: ASC }}
                                  ) {
                    edges {
                      node {
                        Id
                        Name { value }
                        Order_Line_Status__c { value }
                        Program_Date_Product_Descriptive_Name__c { value }
                        Contact_Name__c { value }                           
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    `,
    variables: '$variables',
    operationName: 'ordersByProgramDateId',
}) ```

4
  • Can you add totalCount to see what was total number of results? Note by default graphql only returns 10 records. You can add pageSize to increate the count Nov 29, 2023 at 21:09
  • 2
    @MohithShrivastava the issue was due to graphQl only returning 10 records by default. Once I updated my query to include "first: 200, upperBound: 2000" it worked fine. Nov 30, 2023 at 15:55
  • It is great that you have found and solved the issue yourself. But please remember to add that as an answer to your own question and accept it later. Nov 30, 2023 at 16:13
  • As @RenatoOliveira said make sure to add as an answer. Nov 30, 2023 at 16:31

0

You must log in to answer this question.

Browse other questions tagged .