Skip to main content TDX, the developer conference for the AI agent era is happening now. Watch live on Salesforce+ for exclusive digital content, a revolutionary keynote, and more.

#GraphQL0 utenti parlano di questo argomento

I'm not sure at this point if I'm missing some permissions or something isn't setup correctly in my org. But I have 2 simple examples of graphql below that work fine from the web, but in salesforce field service app they return 0 results. 

 

These examples return 0 records on the field service app, while returning 10 each from the Web. 

 

// TEMP - Test query to see if we can run a basic graphql request against the Work Order Object.

// We expect to get back 10 results. Works on the web. But on field service app it responds with {"uiapi":{"query":{}}}

@wire(graphql, {

query: gql`query workOrdersQuery {

uiapi {

query {

WorkOrder {

edges {

node {

WorkOrderNumber {

value

}

}

}

}

}

}

}`,

operationName: 'workOrdersQuery',

})

workOrdersQueryResult({ errors, data }) {

console.log('*************************************************SIMPLE QUERY!!!!!!!!!!!!');

console.log(errors);

console.log(data);

console.log(data?.uiapi?.query?.WorkOrder);

}

@wire(graphql, {

query: gql`query AccountQuery {

uiapi {

query {

Account {

edges {

node {

Id

Name {

value

}

}

}

}

}

}

}`,

operationName: 'AccountQuery',

})

accountQueryResult({ errors, data }) {

console.log('*************************************************SECOND SIMPLE QUERY!!!!!!!!!!!!');

console.log(errors);

console.log(data);

console.log(data?.uiapi?.query?.Account);

}

Response from that last example is:

- Unknown Field: [object Object]. This field or nested fields cannot participate in normalization

- Unknown Field: Account. This field or nested fields cannot participate in normalization

- {"uiapi":{"query":{}}}

#GraphQL

#Lightning Web Components

#Salesforce Field Service

7 risposte
  1. 29 mag 2023, 08:29

    Can you try adding @category(name: "recordQuery") after the object name in the query?

0/9000

I need your help...

I'm getting the first result with Graphql, but when I call the refresh, returns an undefined 

 

These are the issues in console:

 

ldsAdaptersUiapiGraphql.js:1 Unknown Field: [object Object]. This field or nested fields cannot participate in normalizationldsAdaptersUiapiGraphql.js:1 

 

Unknown Field: Asset. This field or nested fields cannot participate in normalization

 

This is my code:

 

graphqlQueryResult(result) {

    this.totalAssets = 0;

    this.shreddedAssets = 0;

    this.errors = undefined;

    const {

        data,

        errors

    } = result;

    console.log('IN WIRE');

    if (data) {

        console.log(JSON.stringify('data ::' + JSON.stringify(data))) this.results = data.uiapi.aggregate.Asset.edges.map((edge) => edge.node);

        this.totalAssets = data.uiapi.aggregate.Asset.totalCount;

        try {

            this.results.forEach(item => {

                console.log(item);

                console.log(JSON.stringify(item));

                if (item.aggregate.Status.value === 'Shredded') {

                    this.shreddedAssets = item.aggregate.Id.count.value;

                }

            });

        } catch (e) {}

    }

    this.errors = errors;

    this.graphqlData = result; // Store the result so refreshGraphql() can refresh it later    

}

get assetQuery() { // Send a request to the server only if recordId is provided.        

    if (!this.recordId) return undefined;

    return gql(ASSET_QUERY);

}

get variables() {

    return {

        bin: this.recordId

    };

}

async refreshAssetCount() {

    await refreshGraphQL(this.graphqlData);

}

  #GraphQL #LWC

0/9000

Hi All,

I am hoping someone can help me as I have no idea where to start! 

I have been tasked with extracting data from a company (MOZO) that provides API endpoints via graphQL into our Salesforce org.

I can use Altair and Postman to send the POST method to get the data, but am stuck when it comes to doing this in Anypoint Studio so that I can insert it in Salesforce.

Some details:

  • url provided by MOZO is the following: https://marketview.mozo.com.au/graphql/{access token}
    • this url doesn't change
      • How can I reference this as an endpoint to send a payload of the graphQL quey to it in Anypoint? 
  • Payload is sent as POST method (which is fine) and sent as a graphQL query
    • eg. { homeLoans ( limit: 10) { additionalRepayments}}
      • How can I send this as the body of the payload to then get the response?

I am so stuck as I have only ever built applications that create the endpoint for someone to send ME the payload, not needing to send a payload to a pre-existing endpoint url, and I have never used graphQL before so i am not sure if there are extra complexities involved?

 

Any help would be much appreciated! #Anypoint Studio #MuleSoft #GraphQL #Help

4 risposte
  1. 4 nov 2023, 07:48

    Thanks @Sabrina Hockett for notifying me,

     

    Hello Melissa,

     

    Please follow the below steps,

     

    • First build the GraphQL query using DataWeave like below and store it into some variable and then use that variable in the HTTP requester payload body while calling the GraphQL API

    %dw 2.0

    output application/json

    ---

    {

    "query": "{ homeLoans (limit: 10) { additionalRepayments }}"

    }

    Thanks,

    Manish Yadav

    MuleSoft Forum Moderator

0/9000

Hi All,

I am hoping someone can help me as I have no idea where to start! 

I have been tasked with extracting data from a company (MOZO) that provides API endpoints via graphQL into our Salesforce org.

I can use Altair and Postman to send the POST method to get the data, but am stuck when it comes to doing this in Anypoint Studio so that I can insert it in Salesforce.

Some details:

  • url provided by MOZO is the following: https://marketview.mozo.com.au/graphql/{access token}
    • this url doesn't change
      • How can I reference this as an endpoint to send a payload of the graphQL quey to it in Anypoint? 
  • Payload is sent as POST method (which is fine) and sent as a graphQL query
    • eg. { homeLoans ( limit: 10) { additionalRepayments}}
      • How can I send this as the body of the payload to then get the response?

I am so stuck as I have only ever built applications that create the endpoint for someone to send ME the payload, not needing to send a payload to a pre-existing endpoint url, and I have never used graphQL before so i am not sure if there are extra complexities involved?

 

Any help would be much appreciated! #Anypoint Studio #MuleSoft #GraphQL #Help

1 risposta
  1. 2 nov 2023, 14:30

    @Melissa Marsh,

    You can use Http requestor to call the Graph ql similar to rest endpoint call in anypoint studio. 

     

    Pass following http parameter 

    URL -https://marketview.mozo.com.au/graphql/{access token}

    Method - POST

    Content-Type - application/json

    payload -

    { "query": "{ homeLoans ( limit: 10) { additionalRepayments}}" }

0/9000

Watch Dreamforce Developer Innovations on Salesforce +

You can catch up on some of the incredible

#Dreamforce

sessions for developers on demand on our Salesforce + streaming channel.

Check it out!

https://www.salesforce.com/plus/experience/dreamforce_2023/series/developers_at_dreamforce_2023Watch Dreamforce Developer Innovations on Salesforce +You can catch up on some of the incredible sessions for developers on demand on our Salesforce + streaming channel.#DF23 #GraphQL #Developer Tools #Code Builder #Generative AI #Einstein #LWC #DataWeave #Apex
0/9000

Now in Beta: GraphQL Wire Adapter for LWC

 

Regardless of advancements in networking you can never have enough great APIs that really help you reduce the chattiness of web client.

 

Check out this Salesforce Developer blog post from @Suvda Myagmar on the new GraphQL Wire Adapter for LWC, now in Beta. Dive deep into its new capabilities and get started with examples in the LWC Recipes.

 

#LWC #GraphQL

Now in Beta: GraphQL Wire Adapter for LWC Regardless of advancements in networking you can never have enough great APIs that really help you reduce the chattiness of web client.

0/9000

We have started looking into the possibility of adding GraphQL support on top of UI API. 

 

To get a better sense of the landscape, we've put together this survey and would love to hear feedback from folks who are interested in a GraphQL-based solution for interacting with Salesforce data and metadata.

Survey: GraphQL on UI API

2 commenti
  1. 17 lug 2023, 15:59

    Hey Scott! We actually just recently released an adapter for GraphQL, currently allowing you to access data stored in Amazon RDS, Amazon Redshift, and other data stores in a zero-copy manner. Information is still coming out from both us and AWS on this, but I'd look at this blog post for a starter and our developer guides to get more information. We're hoping to expand this solution to more endpoints in the future! Let us know any feedback if you end up deploying the adapter!

0/9000

📣 Exciting Announcement! 🎉

 

Introducing the Salesforce GraphQL API and LWC Wire Adapter Trailblazer Community Group! 🚀

We are thrilled to announce the launch of our brand new community group dedicated to exploring the power of the Salesforce GraphQL API and Lightning Web Components (LWC) GraphQL Wire Adapter. This is an incredible opportunity for Salesforce developers and enthusiasts to come together, share knowledge, and learn from each other about these cutting-edge technologies.

 

🔗 What is the Salesforce GraphQL API?

The Salesforce GraphQL API is a powerful data query and manipulation language that provides a flexible and efficient approach to fetching data from your Salesforce org. It enables you to precisely request only the data you need, reducing network overhead and improving performance. With the GraphQL API, you can now access Salesforce data in a more intuitive and personalized manner. Get started today!

 

🔗 What are Lightning Web Components (LWC) and the Wire Adapter?

Lightning Web Components (LWC) is a modern framework that empowers developers to build efficient, reusable, and responsive web components on the Salesforce platform. These components can be used to create rich user interfaces and seamless experiences. The LWC Wire Adapter simplifies data integration by providing a declarative way to fetch and update data from Salesforce without the need for complex Apex code. Get started today!

 

👥 Who is this community group for?

This Trailblazer Community Group is for developers, admins, and Salesforce enthusiasts who are eager to explore the Salesforce GraphQL API and harness the power of our GraphQL Wire Adapter for LWC. Whether you are a beginner or an experienced developer, this group is the perfect platform for you to engage, learn, and share your expertise with like-minded individuals.

 

💡 What can you expect from this community group?

By joining this group, you will gain access to a vibrant community of experts and peers who are passionate about Salesforce development. Here's what you can expect:

1. Knowledge Sharing: Learn from experienced developers and thought leaders who will share best practices, tips, and tricks to leverage the Salesforce GraphQL API and GraphQL Wire Adapter effectively.

2. Q&A: Engage in lively discussions, ask questions, and get answers from community members and Salesforce experts who are actively working with the GraphQL API and GraphQL Wire Adapter.

 

📢 Join Us Today!

Don't miss out on this incredible opportunity to explore the Salesforce GraphQL API and LWC Wire Adapter. Join the Salesforce GraphQL API and LWC Wire Adapter Trailblazer Community Group today, and let's unlock the potential of these game-changing technologies together!

#GraphQL #Lightning Web Components

1 commento
0/9000

🌟 Exciting Announcement for the Salesforce Trailblazer Community! 🚀☁️

 

Join us for a virtual event featuring renowned speaker @Alba Rivas, as she shares her expertise on "Taking Control of Your Queries with GraphQL."

 

📅 Save the Date: Wed, Jun 14, 6:45 PM (WEST)

🔗 Registration: https://trailblazercommunitygroups.com/j/83vptx6tk8r8f/

 

GraphQL is a database query language and an API runtime that allows you to work with exactly the data that you need, and no more. With GraphQL the number of database operations is reduced, the number of endpoints needed is reduced, and APIs become faster, more flexible and more developer-friendly. In this session we’ll explore the new Salesforce GraphQL API, and the new LWC wire adapter that allows you to use the GraphQL API from LWC, a game changer!

 

Don't miss out on this exclusive Salesforce Trailblazer Community event! Reserve your spot now and join us virtually from anywhere in the world. 🌎

 

#GraphQL #LWC #Salesforcecommunity #Salesforce Developer

0/9000

The article "Unlocking the Power of GraphQL in Salesforce LWC" discusses how to use the GraphQL query language in Salesforce Lightning Web Components (LWC) to retrieve data from Salesforce.

https://sfdclesson.com/2023/01/16/unlocking-the-power-of-graphql-in-salesforce-lwc/

#Salesforce Developer #Lightning Web Components #GraphQL

The article

0/9000