本番組織では直接Apexクラスやトリガを作成できません。まずSandboxで作成し、テスト後にデプロイしてください。
本番組織上に Apex クラス / Apex トリガを、(直接)新規作成することはできません。
本番組織上に Apex クラス / Apex トリガを構築する上での注意点を以下に記載します。
1. Apex クラス/トリガは、一旦、Developer Edition、Sandbox 上に作成する必要があります。
その後、本番組織上に対して "デプロイ" を実施し、該当の Apex クラス/トリガを移行する必要があります。(※1)
2. それぞれの Apexクラス / トリガには、テストメソッドを用意する必要があります。(※2)
組織全体のテストメソッドの実行結果として 75 %以上のカバレージをクリアしていないと、本番組織に "デプロイ" できません。
実際の Apex クラス/トリガに加えて、テストメソッドも合わせたものを、本番組織にデプロイします。
※1
"デプロイ" 作業を実施するには、以下のいずれかのツールを使用する必要があります。
Salesforce のユーザインターフェース上での作業が可能で、最も扱いやすい「変更セット」をお勧めします。
(ただし、変更セットを使用した場合、Sandbox → 本番組織 のみの対応となります。)
a. 変更セット (Sandbox → 本番組織)
変更セットのリリース接続
b. Salesforce CLI (Developer、Sandbox → 本番組織)
Deploying and Retrieving Metadata
※2
テストメソッドについての詳細な情報については以下を参照してください。
Testing Apex
※3
Apex クラス/トリガの作成から、本番組織までの展開の流れは、下記の資料に詳しい記載があります。
What is the Apex Development Process?
000385334

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.