Another Update: With Spring '23, there is a pilot for the GraphQL wire adapter. This would allow you to perform a query on any UI API enabled object and get the records without needing apex.
import { LightningElement, wire } from 'lwc';
import { gql, graphql } from 'lightning/uiGraphQLApi';
export default class ExampleGQL extends LightningElement {
@wire(graphql, {
query: gql`
query AccountInfo {
uiapi {
query {
Account(where: { Name: { like: "United%" } }) @category(name: "recordQuery") {
edges {
node {
Name @category(name: "StringValue") {
value
displayValue
}
}
}
}
}
}
}`
})
propertyOrFunction
}
Update: With Spring '22, there is now a uiRelatedList module in beta that would allow you to retrieve related list records from a single record without apex.
This module includes new wire adapters to get records, metadata, and
record count for a related list.
getRelatedListRecords
— Returns record
data for a related list.
getRelatedListInfo
— Returns metadata for a
related list.
getRelatedListsInfo
— Returns metadata for multiple
related lists.
getRelatedListCount
— Returns the record count for a
related list.
import { LightningElement, wire } from 'lwc';
import { getRelatedListRecords } from 'lightning/uiRelatedListApi';
export default class LdsGetRelatedListRecords extends LightningElement {
@wire(getRelatedListRecords, {
parentRecordId: '001RM000003UNu6YAG',
relatedListId: 'Contacts',
fields: ['Contact.Name','Contact.Id']
})
}
original answer
I don't believe you can.
https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.data_wire_example
You can utilize the lightning data service to get the current RecordId when it's displayed on one, but I'm not aware of a way to query for specific records with specific text without utilizing apex to do that query.