Slide 1

Slide 1 text

Welcome to #YD23 Brussels

Slide 2

Slide 2 text

Bring data to your LWC without Apex using the GraphQL Wire Adapter Fabien Taillon CTO at Texeï - Salesforce MVP @FabienTaillon

Slide 3

Slide 3 text

Fabien Taillon • Salesforce MVP Hall of Fame • CTO at Texeï • Paris Developer Group Leader • French Touch Dreamin team • Serial speaker @FabienTaillon https://texei.com/blog Who am I

Slide 4

Slide 4 text

- Created by Facebook in 2012 - No need to call several APIs - Get many resources in a single request - Ask for what you need, get exactly that - Self documented - With a type system A query language for your API source: Michael Poirier-Ginter What is GraphQL

Slide 5

Slide 5 text

• a read only stream of data • shared cache between components (standard & custom) • reactive to changes outside of the component’s scope • no Apex with standard Lightning Data Service Wire Adapters • just import it and use it 🎉 What is a Wire Adapter

Slide 6

Slide 6 text

A GAME CHANGER What is the GraphQL Wire Adapter

Slide 7

Slide 7 text

Query any list of records you want - Order them - Group them - … Easy to use because - you don’t need to write any Apex - respects user Field Level Security - use the same shared Lightning Data Service cache Get for a custom component - a list of all contacts for a given account - a search page - a hierarchy of records - one specific record with filters, without knowing its Id at first - … What is the GraphQL Wire Adapter

Slide 8

Slide 8 text

- An easy to use local client to test your queries - Get an access token - for instance use sf org display - Use the following url: - https://{MyDomainName}.my.salesforce.com/services/data/v{version}/graphql - Then you can: - query - autocomplete - look at API documentation (display existing fields, available formatting etc) https://ww.altairgraphql.dev Connect to GraphQL API Altair GraphQL Client

Slide 9

Slide 9 text

DEMO GraphQL Wire Adapter

Slide 10

Slide 10 text

Filter, order, query relationships, use variables… GraphQL Wire Adapter

Slide 11

Slide 11 text

Filter, order, query relationships, use variables… GraphQL Wire Adapter

Slide 12

Slide 12 text

Filter, order, query relationships, use variables… GraphQL Wire Adapter

Slide 13

Slide 13 text

Filter, order, query relationships, use variables… GraphQL Wire Adapter

Slide 14

Slide 14 text

- Backward pagination - Filter with no value - Actually more GraphQL than Salesforce “issue” - No mutation (on the roadmap) What’s not available (yet ?)

Slide 15

Slide 15 text

https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000kRExSAM GraphQL API & LWC Wire Adapter Community Group Join the GraphQL API & LWC Wire Adapter Trailblazer Community Group

Slide 16

Slide 16 text

Demo source code: https://github.com/FabienTaillon/graphql-wire-adapter-demo Developer Guide: https://developer.salesforce.com/docs/platform/graphql/guide/graphql-wire-lwc.html GraphQL Wire Adapter for LWC Blog Post: https://developer.salesforce.com/blogs/2023/02/now-in-pilot-graphql-wire-adapter-for-lwc GraphQL API & LWC Wire Adapter Trailblazer Community Group: https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000kRExSAM Resources

Slide 17

Slide 17 text

Q&A #YD23 Brussels