vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Class SalesforceLookupService

    Look up records from Salesforce using an more convenient syntax

    Index

    Constructors

    Properties

    logger: Logger
    nsService: NamespaceService
    queryService: QueryService

    Methods

    • Enables or disables the lookup cache for all lookups performed by this service instance.

      • When enabled, the lookup cache will be used for all lookups unless explicitly disabled using the useCache parameter.
      • When disabled, the lookup cache will not be used for any lookups and the value of the useCache parameter will be ignored.

      Parameters

      • enabled: boolean

        A boolean value indicating whether the lookup cache should be enabled or disabled.

      Returns void

    • Query multiple records based on the where condition. The filter condition can either be a string or a complex filter object.

      Type Parameters

      • T extends object
      • K extends PropertyKey = keyof T

      Parameters

      • type: string

        Name of the SObject type to lookup

      • Optionalfilter: LookupFilter<T>

        Object filter or Where conditional string, by default the object filter uses and equals comparison (=). A different comparison mode can be specified by prefixing the value with any of these operators:

        • !=: not equals
        • >: greater then
        • <: smaller then
        • ~: like/contains

        Arrays are interpreted as as includes operator. For example:

        lookup('Account', { Name: ['Peter', 'ACME'] }, ['Id', 'Name'] )
        

        will translate to the follow query: select Id, Name from Account where Name includes ('Peter', 'ACME')

        You can also specify multiple filters by passing an array of objects or strings:

        lookup('Account', [{ Name: 'Peter' }, { Name: 'ACME' }], ['Id', 'Name'] )
        

        Which will translate to the follow query: select Id, Name from Account where (Name = 'Peter') or (Name = 'ACME')

      • OptionallookupFields: "all" | K[] | readonly K[]

        fields to lookup on the record, if not field list is provided this function will lookup All fields. Note that the Id field is always included in the results even when no fields are specified, or when a limited set is specified.

      • Optionallimit: number

        limit the number of results to lookup, set to 0, null, undefined or false to not limit the lookup results; when specified as 1 returns a single record instead of an array.

      • OptionaluseCache: boolean

        when true instructs the QueryService to cache the result in case of a cache miss and otherwise retrive the cached response. The default behavhior depends on the

      • OptionalcancelToken: CancellationToken

      Returns Promise<QueryResult<T, K>[]>

      QueryService configuration.

    • Looks up a single record by ID.

      Type Parameters

      • K extends PropertyKey

      Parameters

      • id: string

        The ID of the record to lookup

      • OptionallookupFields: "all" | K[]

        Fields to lookup; when all or undefined all fields are fetched

      • OptionaluseCache: boolean

        Optionally use the query cache for retrieving the request records

      • OptionalcancelToken: CancellationToken

        Optional cancellation token to signal the method that it should quit as soon as possible.

      Returns Promise<undefined | QueryResult<{ Id: string }, K>>

      The record or undefined if it doesn't exist

    • Lookup multiple records by ID and returns their values mapped by record ID

      Type Parameters

      • K extends PropertyKey

      Parameters

      • ids: Iterable<string>

        Iterable list of IDs

      • OptionallookupFields: "all" | K[]

        Fields to lookup; when all or undefined all fields are fetched

      • OptionaluseCache: boolean

        Optionally use the query cache for retrieving the request records

      • OptionalcancelToken: CancellationToken

        Optional cancellation token to signal the method that it should quit as soon as possible.

      Returns Promise<Map<string, QueryResult<{ Id: string }, K>>>

      Records in a Map keyed by their record ID

    • Looks up a single record of a given type based on the provided filter.

      Type Parameters

      • T extends object

        The type of the record to lookup.

      • K extends PropertyKey = keyof T

        The type of the lookup fields.

      Parameters

      • type: string

        The type of the record to lookup.

      • Optionalfilter: LookupFilter<T>

        The filter to apply when looking up the record.

      • OptionallookupFields: "all" | K[]

        The fields to include in the lookup result.

      • OptionaluseCache: boolean

        Indicates whether to use the cache for the lookup.

      • OptionalcancelToken: CancellationToken

        The cancellation token.

      Returns Promise<undefined | QueryResult<T, K>>

      • A promise that resolves to the lookup result.
    • Type Parameters

      • T extends object
      • K extends PropertyKey = keyof T

      Parameters

      • type: string
      • Optionalwhere: string
      • selectFields: "all" | K[] | readonly K[] = 'all'
      • Optionallimit: number
      • OptionaluseCache: boolean
      • OptionalcancelToken: CancellationToken

      Returns Promise<QueryResult<T, K>[]>