Skip to main content

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 answers
  1. May 29, 2023, 8:29 AM

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

0/9000