---
schema_version: "1"
id: 4e3d883b255e8fbb8d1111de634aef6cb46d4791952a4dbac9616aa1e32c83af
title: Configuring an Apex Remote Data Source (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_configuring_an_apex_remote_data_source.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_configuring_an_apex_remote_data_source.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 67db51d74f80abc50f92ca75b8cf220de28ce93c10c6fc41378d189ee55f2297
description: For the managed package runtime, configure a data source to invoke an Apex Class and method to fetch data to populate a card.
products:
  - Omnistudio
release: "264"
---
# Configuring an Apex Remote Data Source (Managed Package)

For the managed package runtime, configure a data source to invoke an Apex Class and method to fetch data to populate a card.

Before you begin:

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

- Know the Apex remote class and method you need to invoke before you can configure a remote data source. Managed packages can include Apex remote classes and methods.
    
    To see existing Apex classes:
    
    1. In your org, go to Setup, and in the **Quick Find** box, enter Apex.
    2. Click **Apex Classes**.
- Beginning with Vlocity Health and Insurance Spring '21, add an Apex class permissions checker to ensure only authorized users can access VlocityOpenInterface classes (APIs) from a remote action on a card.

Apex remote data sources can run asynchronously through Apex. This increases the CPU time but ensures that long-running transactions are not timed-out.

For optimal flexibility and easier implementation, use an Integration Procedure as a data source to execute multiple actions in a single server call.

1. In your org, click the App Launcher, click Vlocity Cards, click a version of a card layout to open the Card Designer.
2. In the Layout or Cards pane, from the **Data Source** picklist, select **Apex Remote**.
    
    ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/apexremotedatasource.png)
3. Enter the name of the **Remote Class**.
    
    ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/screenshot___apex_class.png)
    
    ![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/images/icon_important.png)
    
    Important
    
    The Apex Class must implement the Vlocity Open Interface otherwise an error message displays.
4. Enter the name of the Remote Method.
    
    For example, you can access the remote Apex method getStories from the remote Apex class StoryListHandler.
5. Click **\+ Add Input Map Variable** to add one or more name-value pairs to pass to the remote Apex class method.
    
    ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/ds_input_map_apex_remote.png)
    
    For example, to use the Page Parameters `{{params}}` [context variable](https://help.salesforce.com/s/articleView?id=xcloud.os_cards_context_variables.htm&release=264.0.0&type=5 "For the managed package runtime, several variables are available across the framework to provide contexts to cards, data sources, flyouts, templates, and other components.") to dynamically get the ContextId for your layouts and cards:
    
    1. In the first field of the _Input Map_, enter a ContextId form your Apex class method, such as `AccountId`.
    2. In the second field of the _Input Map_, enter `{{params.id}}` as the value. Parameters passed to the page are stored in the `{{params}}` context variable for use anywhere in the Vlocity Cards framework. In this case, your card or layout inherits the Id of the record page it's on in order to dynamically populate the card with that record's data. The remote method receives an inherited value as an Account Id from the layout or card, not the literal string `{{params.id}}`.
6. Click **+Add Options Map Variable** to add option variables to the map passed to the remote method.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/images/icon_note.png)
    
    Note
    
    By default the `NS.IntegrationProcedureService` continuation object is set for you to use asynchronous callouts to make long-running requests from a Visualforce page to an external Web service and process responses in callback methods. `NS` represents your org's Namespace, such as `vlocity_ins` or `vlocity_cmt`, as in `vlocity_ins.IntegrationProcedureService`.
7. (Optional). Enter values for these properties:
    
    - To drill down to a specific dataset, in the **Result JSON Path** field, enter a path. For example, enter records.results, which drills down to the `results` array and passes the array to the card or card layout.
    - To sort data by a specific data field, enter the field name in the **Order By** input field.
    - To reverse the order of the data returned, select **True** from the **Reverse Order** picklist.
        
        ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/orderbyreverseorder.png)
    - Set a **Timeout** value in milliseconds.
        
        The timeout value controls the time that the framework waits for the designated data source to return a response. Timeouts improve handling user interactions with long running processes. Setting an appropriate timeout value allows the application and users to react accordingly to long wait times.
    - Set an **Interval** value in milliseconds.
        
        The card component's data source refreshes continuously at the given interval and checks for changes in data source records. If changes are found, the layout or card component reloads. Setting an interval enables recursive updates of records.
8. Preview a card using real data, add a test variable in the **Test Data Source Settings** fields.