---
title: "Lusid.CorporateAction.Source.Writer"
slug: "lusidcorporateactionsourcewriter"
updated: 2025-08-01T13:20:43Z
published: 2025-08-01T13:20:43Z
canonical: "support.lusid.com/lusidcorporateactionsourcewriter"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lusid.CorporateAction.Source.Writer

| **Type** | **Read/write** | **Author** | **Availability** |
| --- | --- | --- | --- |
| [Data provider](/v1/docs/what-are-a-data-provider-and-a-direct-provider) | Read | Finbourne | Provided with LUSID |

The `Lusid.CorporateAction.Source.Writer` provider enables you to write a [Luminesce SQL query](/v1/docs/understanding-the-luminesce-sql-query-syntax) that either creates or deletes [corporate action sources](/v1/docs/corporate-actions) in LUSID.

You must construct a valid table of data to write, one corporate action source per record. `Lusid.CorporateAction.Source.Writer` lists the fields (columns) available to populate with values for each record, and has a set of parameters to help you construct a valid table.

Your query can use the `WriteAction` field to perform one of the following operations:

- Create a corporate action source. This is the default operation if you omit `WriteAction`.
- Delete a corporate action source. Note this deletes any corporate actions uploaded to that source.

**See also**: [Lusid.CorporateAction.Source](/v1/docs/lusidcorporateactionsource)

## Basic usage

```sql
@table_of_data = <select-statement>;
select * from Lusid.CorporateAction.Source.Writer where toWrite = @table_of_data;
```

## Query parameters

`Lusid.CorporateAction.Source.Writer` has parameters that help you construct a valid table of data to write.

> [!NOTE]
> **Note:** The `toWrite` parameter is mandatory and used to actually write the table of data into LUSID.

To list available parameters, their data types, default values, and an explanation for each, run the following query using a [suitable tool](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
select FieldName, DataType, ParamDefaultValue, Description from Sys.Field where TableName = 'Lusid.CorporateAction.Source.Writer' and FieldType = 'Parameter';
```

## Data fields

`Lusid.CorporateAction.Source.Writer` lists the fields you can populate in your table of data to write.

Depending on the operation you want to perform, the following fields are mandatory to include in the table of data:

| **Operation** | **Specify using...** | **Mandatory fields** | **Notes** |
| --- | --- | --- | --- |
| Create | `'Insert' as WriteAction` (or omit) | `CorporateActionSourceScope` `CorporateActionSourceCode` `DisplayName` `InstrumentScopes` | Specify a single custom [instrument scope](/v1/docs/understanding-instrument-scopes) if transaction portfolios you intend to register with this corporate action source resolve economic activity to instruments mastered in that scope. Omit this field if intended portfolios resolve to instruments in the `default` scope. |
| Delete | `'Delete' as WriteAction` | `CorporateActionSourceScope` `CorporateActionSourceCode` |  |

To list all available fields, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a [suitable tool](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Lusid.CorporateAction.Source.Writer' and FieldType = 'Column';
```

## Examples

> [!NOTE]
> **Note:** For more example Luminesce SQL queries, visit our [Github repo](https://github.com/finbourne/luminesce-examples/tree/master/examples).

### Example 1: Create a corporate action source

In this example, the `InstrumentScopes` field is omitted, so [transaction portfolios](/v1/docs/how-do-i-create-a-transaction-portfolio) subsequently registered with this corporate action source must all resolve economic activity to instruments in the `default` scope.

```sql
@table_of_data = select 'Example-CAS-Scope' as CorporateActionSourceScope, 'Example-CAS-Code' as CorporateActionSourceCode,
'Example corporate action source' as DisplayName, 'This is an example corporate action source' as Description;
select * from Lusid.CorporateAction.Source.Writer where ToWrite = @table_of_data;
```

### Example 2: Delete a corporate action source

```sql
@table_of_data = select 'Example-CAS-Scope' as CorporateActionSourceScope, 'Example-CAS-Code' as CorporateActionSourceCode, 'Delete' as WriteAction;
select * from Lusid.CorporateAction.Source.Writer where ToWrite = @table_of_data;
```
