salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.63k stars 393 forks source link

GraphQL semi-join datetime filters not working #3603

Open piyushvaddoria opened 1 year ago

piyushvaddoria commented 1 year ago

Description

I am trying to run a GraphQL query using a semi-join query with a date time filter on the CreatedDate field. The query is saved but when I run the component it's throwing an error.

Steps to Reproduce

@wire(graphql, {
        query: gql`
        query {
            uiapi {
                query {
                    ObjectA__c (where: {CreatedDate:{gte:{value:"2021-01-01T00:00:00Z"}}}) {
                        edges {
                            node {
                                Id
                                Name {value}
                                Account__c {value}
                                CreatedDate {value}
                            }
                        }
                    }
                    ObjectB__c (where: {
                        Account__c: { 
                            inq: {
                                ObjectA__c: { 
                                    CreatedDate: {
                                        gte:{value: "2021-01-01T00:00:00Z"}
                                    }
                                },
                                ApiName:"Account__c"
                            }
                        }
                    }) {
                        edges {
                            node {
                                Id
                                Name { value }
                                Account__c {value}
                                CreatedDate {value}
                            }
                        }
                    }
                }
            }
        }
        `
    })
    async graphqlQueryResult({ data, errors }) {
        if (data) {
            // this.results = await data.uiapi.query.ObjectB__c.edges.map(edge => edge.node);
            console.log(JSON.stringify(data.uiapi.query));
        }
        if(errors){
            console.log('error graphqlQueryResult '+JSON.stringify(errors));
        }
    }

Expected Results

Data from query

Actual Results

error graphqlQueryResult [{"errorType":"adapterError","error":[{"extensions":{"ErrorType":"DataFetchingException"},"locations":[{"column":7,"line":67}],"message":"Exception while fetching data (/uiapi/query/ObjectBc) : invalid value of type ; value must be null, a primitive type (String|ID|Boolean|Integer|Long|Double|Decimal|Date|Datetime), or implement HasSOQL interface","paths":["uiapi","query","ObjectBc"]}]}]

Browsers Affected

All

Version

Possible Solution

Additional context/Screenshots When I change the ObjectAc filter in the ObjectBc query to String filed it's working as expected.

jmsjtu commented 1 year ago

Thanks for opening this issue @piyushvaddoria, this is a Lightning Data Services issue.

@scarrawaySF @jodarove could you take a look when you get a chance?

gjdickens commented 1 year ago

I'm seeing the same issue with a similar anti-join. I guess it must be related, but in case it's helpful, here's a quick snippet of what I'm trying to do that is giving the same error: inq: { Opportunity: { CloseDate: {gte: {range: {last_n_days: 365}}}} }

nolanlawson commented 1 year ago

@gjdickens This issue is unrelated to the LWC open-source framework (this repo). You may get a more expedient solution to this problem by opening a Salesforce Stack Exchange question or a Salesforce case.