---
schema_version: "1"
id: a3b90afa9cc6f42406c02650a29411d239a37d92a8b9a1fe60fd9fd97420433a
title: RecordApexRepresentation Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 63ba3cf44350ab8f07ff96565a4e7db954f7bac7fcc086f3b29cbb44209d9cd0
description: Contains properties and a method to create a serializable representation of a record and its associated data for AI service integration and data processing.Learn more about the constructors available with the RecordApexRepresentation class.Initializes a new instance of the RecordApexRepresentation class with the specified object type, primary record data, and related record data. This constructor represents a structured record and its relationships for consumption by embedded AI logic.Initializes the RecordApexRepresentation class.Stores the type of the object.Stores a list of objects, where each object holds a key-value pair.Stores a list that contains a child or related records associated with the record data.Create detailed, hierarchical record objects and convert them to a custom JSON string for structured AI input.Converts a JSON-formatted string into a RecordApexRepresentation instance. This method parses the provided JSON and constructs a structured record representation that can be used by embedded AI logic.Returns a structured JSON string representation of the RecordApexRepresentation object and its nested related records.
---
# RecordApexRepresentation Class

Contains properties and a method to create a serializable representation of a record and its associated data for AI service integration and data processing.

## Namespace

[embeddedai](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_namespace_embeddedai.htm "The embeddedai namespace provides classes and methods to manage and represent records and data in Apex to support embedded AI features.")

- **[RecordApexRepresentation Constructors](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_constructors)**  
    Learn more about the constructors available with the RecordApexRepresentation class.
- **[RecordApexRepresentation Properties](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_properties)**
- **[RecordApexRepresentation Methods](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_methods)**  
    Create detailed, hierarchical record objects and convert them to a custom JSON string for structured AI input.

## RecordApexRepresentation Constructors

Learn more about the constructors available with the RecordApexRepresentation class.

The RecordApexRepresentation class includes these constructors.

- **[RecordApexRepresentation(objectType, recordData, relatedRecordData)](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_ctor)**  
    Initializes a new instance of the RecordApexRepresentation class with the specified object type, primary record data, and related record data. This constructor represents a structured record and its relationships for consumption by embedded AI logic.
- **[RecordApexRepresentation()](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_ctor_2)**  
    Initializes the RecordApexRepresentation class.

### RecordApexRepresentation(objectType, recordData, relatedRecordData)

Initializes a new instance of the RecordApexRepresentation class with the specified object type, primary record data, and related record data. This constructor represents a structured record and its relationships for consumption by embedded AI logic.

#### Signature

public RecordApexRepresentation(String objectType, List<embeddedai.ApexMap> recordData, List<embeddedai.RecordApexRepresentation> relatedRecordData)

#### Parameters

- **objectType**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)
    
    The object type represented by this record (for example, Account, Case, or a custom object). This value defines the context in which the record data is interpreted by embedded AI processing.
- **recordData**:
    
    Type: List<[embeddedai.ApexMap](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_class_embeddedai_ApexMap "Create, clone, and convert string based key-value pairs to a JSON string format.")\>
    
    The field-level data for the primary record as a collection of key–value pairs. Each ApexMap entry corresponds to a field name and its associated value used to construct the record context.
- **relatedRecordData**:
    
    Type: List<[embeddedai.RecordApexRepresentation](#apex_class_embeddedai_RecordApexRepresentation "Contains properties and a method to create a serializable representation of a record and its associated data for AI service integration and data processing.")\>
    
    Related records associated with the primary record. Each entry represents a related object and its data, enabling hierarchical or relational record context to be passed to embedded AI logic.

### RecordApexRepresentation()

Initializes the RecordApexRepresentation class.

#### Signature

public RecordApexRepresentation()

## RecordApexRepresentation Properties

The following are properties for RecordApexRepresentation.

- **[objectType](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_objectType)**  
    Stores the type of the object.
- **[recordData](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_recordData)**  
    Stores a list of objects, where each object holds a key-value pair.
- **[relatedRecordData](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_relatedRecordData)**  
    Stores a list that contains a child or related records associated with the record data.

### objectType

Stores the type of the object.

#### Signature

public String objectType {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)

### recordData

Stores a list of objects, where each object holds a key-value pair.

#### Signature

public List<embeddedai.ApexMap> recordData {get; set;}

#### Property Value

Type: [List<embeddedai.ApexMap>](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_class_embeddedai_ApexMap "Create, clone, and convert string based key-value pairs to a JSON string format.")

### relatedRecordData

Stores a list that contains a child or related records associated with the record data.

#### Signature

public List<embeddedai.RecordApexRepresentation> relatedRecordData {get; set;}

#### Property Value

Type: [List<embeddedai.RecordApexRepresentation>](#apex_class_embeddedai_RecordApexRepresentation "Contains properties and a method to create a serializable representation of a record and its associated data for AI service integration and data processing.")

## RecordApexRepresentation Methods

Create detailed, hierarchical record objects and convert them to a custom JSON string for structured AI input.

The following are methods for RecordApexRepresentation.

- **[toRecordApexRep(jsonString)](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_toRecordApexRep)**  
    Converts a JSON-formatted string into a RecordApexRepresentation instance. This method parses the provided JSON and constructs a structured record representation that can be used by embedded AI logic.
- **[toString()](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_RecordApexRepresentation.htm#apex_embeddedai_RecordApexRepresentation_toString)**  
    Returns a structured JSON string representation of the RecordApexRepresentation object and its nested related records.

### toRecordApexRep(jsonString)

Converts a JSON-formatted string into a RecordApexRepresentation instance. This method parses the provided JSON and constructs a structured record representation that can be used by embedded AI logic.

#### Signature

public static embeddedai.RecordApexRepresentation toRecordApexRep(String jsonString)

#### Parameters

- **jsonString**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)
    
    The JSON-formatted string containing record data and related record information to be converted into a RecordApexRepresentation object.

#### Return Value

Type: embeddedai.RecordApexRepresentation

Returns a RecordApexRepresentation instance populated with the data parsed from the provided JSON string.

### toString()

Returns a structured JSON string representation of the RecordApexRepresentation object and its nested related records.

#### Signature

public String toString()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)