getRecord Documentation
Overview
getRecord is a Logic component within the Vantage analytics and data platform designed to fetch a single record by its unique identifier (ID) from the contacts application. This functionality is essential for applications that require detailed information on specific contacts, enabling seamless data retrieval and integration within analytics workflows.
Purpose
The primary purpose of getRecord is to allow applications to retrieve a contact record based on its ID. It serves as a bridge to access contact details stored in the backend systems while managing necessary authentication and context information.
Settings
The getRecord function has several settings, which determine its operation and configurations:
1. Setting: recordId
- Input Type: String
- Description: The unique identifier used to fetch the specific record from the contacts application.
- Impact of Change: Modifying this value changes which contact record is retrieved. It must be a valid ID; otherwise, an error will occur.
- Default Value: None (this must be provided for the function to operate).
2. Input: inputs
- Input Type: Object
- Description: This object can contain overridden values for settings, such as
recordId. It allows dynamic input to the component. - Impact of Change: Altering
inputs.recordIdwill take precedence over the default defined in the configuration. This is useful for scenarios where the ID might change during execution. - Default Value:
{}(an empty object).
3. Configuration: config
- Input Type: Object
- Description: This holds the configurable settings for the
getRecordcomponent. If not provided, defaults will apply. - Impact of Change: Ensure that
config.recordIdis set correctly to retrieve the intended record; however, it will be overridden byinputs.recordIdif present. - Default Value:
{}(an empty object).
4. Context: context
- Input Type: Object
- Description: Contains execution context, such as
clientId,userId, and thenodeType. This information is crucial for authenticating the request and determining the application type. - Impact of Change: Changes to
context.nodeTypeinfluence the app type the component interacts with. The absence of a validclientIdorrecordIdwill cause the function to fail. - Default Value:
{}(an empty object).
How It Works
The getRecord function operates as follows:
- Input Handling: It receives input from both the context and function parameters. The
recordIdis derived first frominputsand then fromconfig. - Error Checking: It performs checks to ensure both
clientIdandrecordIdare provided. If either is missing, the function returns an error. - Fetch Configuration: The function retrieves application configuration using
getAppConfig, which is essential for understanding how to proceed with data retrieval. - Data Adapter Creation: It creates a data adapter using
createAppDataAdapter, tailored for the application type and the user's context. - Data Retrieval: Finally, it calls the
getRecordmethod on the adapter, passing the necessary parameters, and returns the result. If no record is found, it returns an empty data array.
Expected Data
The getRecord function expects the following data:
inputs: An object containing at least one property,recordId, which is mandatory.config: An object that can potentially includerecordIdas a fallback.context: An object that must include at leastclientIdto authenticate the request, and may includeuserIdandnodeTypefor additional context.
AI Integrations
Currently, the getRecord function does not have any explicit AI integrations. However, it can be part of larger AI-driven workflows where data retrieval feeds into machine learning models or analytic processing components that provide insights from the fetched data.
Billing Impacts
The getRecord function is charged based on the number of records fetched and the underlying data storage calls made during operability. Each call to the data adapter to retrieve a record may incur a cost, depending on the pricing model of the storage provider associated with clientId. Always monitor usage to avoid unexpected charges.
Use Cases & Examples
Use Case 1: CRM Data Access
In a customer relationship management application, sales representatives need to access detailed records of specific clients for calls or meetings. Using getRecord, they can retrieve current client information quickly based on ID.
Use Case 2: Data Reporting
A team lead might use this function in an analytics dashboard to show detailed profiles of users in reports. By selecting record IDs dynamically based on user input, they can tailor the information displayed.
Use Case 3: Contact Update Features
In a data management tool, retrieving a contact record based on the ID can support an interface where users can modify existing contact details. The interface would load current data for editing.
Detailed Example Configuration
Consider a scenario where a CRM application aims to display detailed information about a contact when the user clicks on their name in a list. The getRecord component can be configured as follows:
{
"inputs": {
"recordId": "12345"
},
"config": {
"recordId": "12345" // Can be overridden by inputs
},
"context": {
"clientId": "abcde-12345-fghij-67890",
"userId": "user-123",
"nodeType": "contacts/getRecord"
}
}In this example, when invoked, the component will retrieve the record associated with ID 12345, providing complete access to that specific contact's information for further actions.