> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/recipe/crm/salesforce-recipe-todo.md).

# SalesforceのToDoデータを取得する

{% hint style="success" %}
このレシピについて

このレシピは、[Task | Salesforce プラットフォームのオブジェクトリファレンス | Salesforce Developers](https://developer.salesforce.com/docs/atlas.ja-jp.object_reference.meta/object_reference/sforce_api_objects_task.htm) を参考に記述されています。
{% endhint %}

## **Salesforceの「ToDoデータ」とは**

Salesforce 上で管理される、通話などのToDo項目をはじめとしたビジネス活動のデータです。

データ構造の詳細は、[Task | Salesforce プラットフォームのオブジェクトリファレンス | Salesforce Developers](https://developer.salesforce.com/docs/atlas.ja-jp.object_reference.meta/object_reference/sforce_api_objects_task.htm) で確認可能です。

## **Anyflow Embedで取得する**

Anyflow Embed で Salesforce のToDoデータを取得する手順を紹介します。

Salesforce のToDoデータを**スプレッドシートに一括追加する**というシンプルなソリューションを作成し、ToDoに含まれるデータを把握します。

また、本レシピではSalesforceアクションの「SOQL（WHERE句）を使用してレコードを検索」を利用します。

<figure><img src="https://files.readme.io/c716b49-CleanShot_2024-03-31_at_19.59.412x.png" alt=""><figcaption></figcaption></figure>

### **1.Clickトリガーを設定する**

Clickトリガーを設定します。

<figure><img src="https://files.readme.io/b9650b7-image.png" alt=""><figcaption></figcaption></figure>

### **2.Salesforceの「SOQL（WHERE句）を使用してレコードを検索」アクションを設定する**

Salesforceコネクタを追加します。

<figure><img src="https://files.readme.io/7915c2e-.png" alt=""><figcaption></figcaption></figure>

「SOQL（WHERE句）を使用してレコードを検索」アクションを選択します。

<figure><img src="https://files.readme.io/27c9aec-CleanShot_2024-03-31_at_19.45.562x.png" alt=""><figcaption></figcaption></figure>

以下の通りに設定を行います。取得したToDoデータを `CreatedDate` （作成日時）の昇順で取得します。

| 設定項目名        | 設定値             |
| ------------ | --------------- |
| オブジェクト       | 標準オブジェクト / ToDo |
| SOQL WHERE句  | ※ 設定不要          |
| 取得対象のフィールド   | ※ 設定不要          |
| ソート（基準フィールド） | CreatedDate     |
| ソート（並び順）     | 昇順              |
| オフセット        | ※ 設定不要          |

### **3.スプレッドシートの列名を設定する**

スプレッドシートコネクタを追加し、以下の通りに設定を行います。

| 設定項目名      | 設定値           |
| ---------- | ------------- |
| アクション      | 1行追加          |
| スプレッドシートID | 任意のスプレッドシートID |
| シートID      | 任意のシートID      |

「ヘッダーの列名」は以下の通りに設定します。

```
Id
Subject
OwnerId
Status
Priority
```

「行データ」にも同じ様に設定します。

<figure><img src="https://files.readme.io/4e8b58b-CleanShot_2024-03-31_at_19.52.222x.png" alt="" width="563"><figcaption></figcaption></figure>

### **4.スプレッドシートに一括追記する**

続けてもう1つスプレッドシートコネクタを追加し、以下の通りに設定を行います。

| 設定項目名      | 設定値           |
| ---------- | ------------- |
| アクション      | 行を一括追加        |
| スプレッドシートID | 任意のスプレッドシートID |
| シートID      | 任意のシートID      |

<figure><img src="https://files.readme.io/677257c-_2024-02-26_17.45.08.png" alt=""><figcaption></figcaption></figure>

「ヘッダーの列名」は以下の通りに設定します。

```
Id
Subject
OwnerId
Status
Priority
```

「リストソース」は以下の通りに設定します。

<figure><img src="https://files.readme.io/75e0da8-CleanShot_2024-03-31_at_19.53.282x.png" alt=""><figcaption></figcaption></figure>

「要素フィールド」は以下の通りに設定します。

<figure><img src="https://files.readme.io/fc46d7c-CleanShot_2024-03-31_at_19.54.352x.png" alt=""><figcaption></figcaption></figure>

各要素の入力フィールドは「直接入力」ではなく「Formula」を選択します。 Formula の詳細な利用方法については [Formula](/solution-editor/common-specs/formula.md)で確認可能です。

<figure><img src="https://files.readme.io/a2d29fb-CleanShot_2024-03-31_at_19.56.002x.png" alt="" width="563"><figcaption></figcaption></figure>

### **5.ウィザードを設定する**

必要な認証をウィザードに追加します。

### **6.テストを行う**

テストを行うと、スプレッドシートにデータが追加されていることがわかります。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/recipe/crm/salesforce-recipe-todo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
