4 Reports
GraphQL query fails prefetch with an "Unknown Field" warning
Created
Found in Release
Winter '24
Last Updated
Reference ID
W-14088402
Summary
In Spring '23, you had to include metaschema directives (@category
) in GraphQL queries that were embedded within Lightning web components (LWCs). In Summer '23, Salesforce automatically generates these directives when you deploy LWCs to the org, and you were instructed to remove the hardcoded metaschema directives from your GraphQL queries.
However, in mobile environments such as in the Salesforce mobile app, Salesforce Field Service, or Mobile Offline, these custom Lightning web components with GraphQL queries can fail during prefetch. This failure occurs in mobile apps when running GraphQL queries offline that have previously been prefetched.
Error Details
Steps to Reproduce
GraphQL queries in custom LWCs can't be primed for mobile offline use, which worked previously when metaschema directives must be manually added in the GraphQL queries.
Workaround
We recommend that you disable metaschema generation if you encounter this prefetch issue. To disable metaschema generation, please contact your CS partner to initiate this temporary work around. After disabling metaschema generation, you must manually add metaschema directives to your GraphQL queries, which also preserves priming functionality.
Note that disabling metaschema generation also disables referential integrity for GraphQL queries. Any entity or field renames or deletes may cause compilation errors in the LWC components that you will need to manually resolve.
See Also
Knowledge Article: Metaschema directives are required for Mobile Offline due to prefetch failures
Salesforce Help: Mobile Offline
4 Reports