Files
developer.sailpoint.com/docs/connectivity/saas-connectivity/connector-customizers/customizer-commands/source-data-read.md
darrell-thobe-sp 2cd5ccfc81 Prettified Code!
2024-04-18 10:31:05 +00:00

77 lines
1.8 KiB
Markdown

---
id: source-data-read-customizer
title: Source Data Read
pagination_label: Source Data Read
sidebar_label: Source Data Read
keywords: ['connectivity', 'connectors', 'Source Data Read']
description: Intercept the source data read command.
slug: /connectivity/saas-connectivity/customizers/commands/source-data-read
tags: ['Connectivity', 'Connector Command']
---
## Overview
Use these commands to intercept the [source-data-read](../../commands/source-data-read) command.
| Input/Output | Data Type |
| :----------- | :---------------------: |
| Input | StdSourceDataReadInput |
| Output | StdSourceDataReadOutput |
### Example StdSourceDataReadInput
```javascript
{
"sourceDataKey": "name",
"queryInput": {
"query": "fetchAll",
"limit": 10
}
}
```
### Example StdSourceDataReadOutput
```javascript
[
{
key: 'id',
label: 'Id',
subLabel: 'Airtable Base Id',
},
{
key: 'name',
label: 'Name',
subLabel: 'Airtable Source Table Name',
},
];
```
## Implementation
### Before source-data-read command
Use this logic to implement the command:
```javascript
.beforeStdSourceDataRead(async (context: Context, input: StdSourceDataReadInput) => {
logger.info(`Running before source data read. Query: ${input.queryInput?.query}`)
return input
})
```
The `input` object can be mutated and returned, but the same data type must still be returned.
### After source-data-read command
Use this logic to implement the command:
```javascript
.afterStdSourceDataRead(async (context: Context, output: StdSourceDataReadOutput) => {
logger.info(`Running after source data read first query record key: ${output[0].key}`)
return output
})
```
The `output` object can be mutated and returned, but the same data type must still be returned.