※この記事は英語版を翻訳しており、一部機械翻訳を含むため内容は後日更新される可能性があります。最新の内容は英語版を参照してください。表示言語は画面右下の言語名から切り替えられます。
ケースを作成または編集するとき、特定のシナリオで AccountId にアクセスできない場合があります。以下で、再現可能なシナリオとその結果について説明します。
trigger DebugCaseValues on Case (before insert, before update) {
for(Case c : Trigger.new)
System.debug('##### Case values: ' + c);
}
結果では、標準ユーザーの場合、ケース作成時に取引先と取引先責任者の両方が割り当てられているにもかかわらず、Before Insert イベントで AccountId が null を返していることが確認できます。
この結果は、ケース、取引先責任者、取引先のレコード間での関係の実装が複雑であるため、設計どおりに動作していると考えられます。
取引先項目が参照のみ (ページレイアウトあるいは項目レベルのセキュリティによって決定されるため) であることから、AccountId は、渡された取引先レコードを介してデータベースでレビューされています。その結果、AccountId が Apex トリガで null となります。保存されると、実行順で After Trigger イベントの直前に、正しい ID が入力されます。
回避策は次のとおりです。
*メモ: この提案は標準的な実装に基づくものです。必要なコードは、ケースオブジェクトの実装によって異なる場合があります。
000387008

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.