Skip to content

Commit

Permalink
Merge pull request #58 from mahendrn/main
Browse files Browse the repository at this point in the history
Fix code pattern to run GraphQL query
  • Loading branch information
khawkins authored Sep 8, 2023
2 parents 05397fd + 07829ff commit e2965fe
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,27 @@ export default class AccountRelatedContacts extends NavigationMixin(
@api recordId;

get accountQuery() {

Check warning on line 12 in force-app/main/default/lwc/accountRelatedContacts/accountRelatedContacts.js

View workflow job for this annotation

GitHub Actions / Linting on Ubuntu with Node 18

Getters can only contain a return statement
return !this.recordId
? undefined
: gql`
query accountWithChildContacts($recordId: ID) {
uiapi {
query {
Account(where: { Id: { eq: $recordId } }) {
edges {
node {
Contacts {
edges {
node {
Id
Name {
value
}
Phone {
value
}
Email {
value
}
}
if (!this.recordId) return undefined;

return gql`
query accountWithChildContacts($recordId: ID) {
uiapi {
query {
Account(where: { Id: { eq: $recordId } }) {
edges {
node {
Contacts {
edges {
node {
Id
Name {
value
}
Phone {
value
}
Email {
value
}
}
}
Expand All @@ -41,7 +39,9 @@ export default class AccountRelatedContacts extends NavigationMixin(
}
}
}
`;
}
}
`;
}

// https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_graphql_relationships
Expand Down

0 comments on commit e2965fe

Please sign in to comment.