> For the complete documentation index, see [llms.txt](https://docs.mashmatrix.com/mashmatrix-sheet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mashmatrix.com/mashmatrix-sheet/ja/customization/start_custom_apex_visualforce.md).

# Apexコード / Visualforceページの起動

カスタムアクション機能を利用することで、Salesforce上で開発したApexコードおよびVisualforceページをSheetから呼び出すことも可能です。

## Visualforceページの起動

Visualforceページを呼び出すには、「URLを開く」アクションからページURLに以下の形式でURLを入力します。

`/apex/{Visualforceページの名前}`

管理パッケージに含まれるVisualforceページなど、名前空間を持っている場合には、以下の形式でURLを入力します。

`/apex/{名前空間プレフィックス}__{Visualforceページの名前}`

アクションの詳細設定からパラメータ名を適切に指定します。VisualforceページのApexコントローラからは以下のコードでパラメータ値を取得することが可能です。

```
ApexPages.currentPage().getParameters().get('id');
```

## Apexコードの起動

Apexで記述したカスタムのロジックをSheetから呼び出したい場合は、一旦フローを介して起動するのが最も効果的です。カスタムアクションでのフローの起動方法は「[フローの起動](/mashmatrix-sheet/ja/customization/start_visual_workflow.md)」を参照してください。

フローからApexの呼び出しを行うには`@InvocableMethod`を実装した静的メソッドを持つApexクラスを用意する必要があります。詳しくはSalesforceのヘルプおよび開発者資料を参考にしてください。


---

# 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.mashmatrix.com/mashmatrix-sheet/ja/customization/start_custom_apex_visualforce.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.
