• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

platform-sharing-owd-configure

プラグイン
salesforce-development
ソース
GitHub で見る ↗
説明

次のような場合に使用: ユーザーがSalesforce(営業管理システム)のオブジェクト(データの種類)に対して、組織全体のデフォルト共有設定(OWD = 初期状態での情報公開範囲)を確認または変更したい場合。 **発動する場面:** - 現在のOWD設定を確認したい - 共有のデフォルト設定を表示したい - デフォルトのアクセス権限(「非公開」「読み取り専用で公開」「読み取り・書き込み可で公開」「親レコードに準ずる」など)を変更したい - 標準オブジェクト(あらかじめ用意されたデータ種類)またはカスタムオブジェクト(独自に作成したデータ種類)の内部・外部アクセスを設定したい - 「組織全体のデフォルト」に言及している - レコード(データ行)を非公開にしたい、または閲覧者を制限したい - オブジェクトの初期公開範囲を管理したい - .settings-meta.xml 形式ファイルの共有フィールドや .object-meta.xml ファイルの sharingModel に関連している **発動しない場面:** 共有ルール、条件付き共有、役職階級、または手動での共有について質問されている場合は、この機能を使わず「platform-sharing-rules-generate」に任せてください。

原文を表示

Use when the user wants to retrieve or update Organization-Wide Default (OWD) sharing settings for Salesforce objects. TRIGGER when: user asks to check current OWD settings, view sharing defaults, change default access levels (Private, Public Read Only, Public Read/Write, Controlled by Parent), configure internal or external access for standard or custom objects, mentions org-wide defaults, wants to make records private or restrict who can see records, wants to control default record visibility for an object, or references .settings-meta.xml sharing fields or sharingModel in .object-meta.xml files. DO NOT TRIGGER when: user asks about sharing rules, criteria-based sharing, role hierarchy, or manual sharing — delegate to platform-sharing-rules-generate.

ユースケース
  • 現在のOWD設定を確認したい
  • デフォルトのアクセス権限を変更したい
  • オブジェクトの内部・外部アクセスを設定したい
  • レコードの閲覧者を制限したい
  • オブジェクトの初期公開範囲を管理したい
本文(日本語訳)

組織全体のデフォルト設定を管理する

Salesforce の組織内で、標準オブジェクトとカスタムオブジェクト(自社で作成したデータ構造)の組織全体デフォルト(OWD、複数ユーザー間で共有する際のデフォルトアクセス権限)を取得・更新します。OWD は、ユーザーが自分で所有していないレコードにアクセスできるベースラインレベルを定義します。

対応範囲

  • 対応内: OWD 設定の取得、標準オブジェクト・カスタムオブジェクトの内部/外部アクセスレベルの更新
  • 非対応: 共有ルール、ロールの階層構造設定、手動共有、権限セット、条件ベースの共有 — 各専門スキルに任せます

確認事項

進める前に、ユーザーに次の点を確認してください(不明な場合):

  • OWD 設定を取得・更新したいオブジェクトはどれですか?
  • 設定したいアクセスレベルは何ですか?(非公開、読み取り専用、読み書き可能、親で制御)
  • 内部アクセスと外部アクセスの両方を変更しますか?それとも一方だけですか?

必須入力項目

進める前に、次の項目を集めるか推測してください:

  • 対象組織: クエリ・更新対象の組織エイリアスまたはユーザー名(指定がなければデフォルト組織を使用)
  • オブジェクト名: 標準オブジェクト API 名(例:Account、Contact)またはカスタムオブジェクト API 名(例:Invoice__c)
  • 操作内容: 取得(現在の設定を確認)または更新(アクセスレベルを変更)
  • アクセスレベル(更新の場合): 内部アクセスと外部アクセスの値

デフォルト設定(指定がない場合):

  • デフォルト接続中の組織を使用
  • アクセスレベルが1つだけ指定された場合は、内部アクセスに適用すると見なします

実行フロー

すべてのステップは順序立てて実行してください。スキップや順序変更はしません。

フェーズ 1 — 現在の設定を確認

  1. Salesforce CLI Tooling API を使用して現在の OWD 設定をクエリ:

    sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE QualifiedApiName = '<ObjectName>'" --use-tooling-api --target-org <org>
    
  2. すべての OWD 設定を一度に取得する場合:

    sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE IsCustomizable = true ORDER BY QualifiedApiName" --use-tooling-api --target-org <org>
    
  3. 結果を見やすく表示 — references/access_levels.md で有効な値を確認し、ユーザーに対して整形されたテーブルを表示してください。

フェーズ 2 — 設定を更新(必要な場合)

  1. 変更不可・固定 OWD をチェック — references/access_levels.md の「変更不可・固定 OWD オブジェクト」セクションを読んでください。リクエストされた変更が固定値(例:価格表の外部 OWD)をターゲットにしている場合は、直ちに中止してユーザーに、この値はプラットフォームで固定されており変更不可であることを説明してください。デプロイを試みないでください。

  2. リクエストされたアクセスレベルを検証 — references/access_levels.md を読んで、その値が対象オブジェクトに対して有効かを確認してください。値が許可されているセットに含まれていない場合は、どの値が有効かを説明し、ユーザーに1つ選ぶよう求めてください。代替値を推測しないでください。

  3. メタデータ API を使用してオブジェクトメタデータを取得(標準オブジェクト・カスタムオブジェクト共通):

    sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>
    

    これにより <ObjectName>.object-meta.xml(<sharingModel> と <externalSharingModel> を含む)を取得します。詳細は references/metadata_api_approach.md を参照してください。

  4. 共有設定を修正 — オブジェクトの .object-meta.xml 内の <sharingModel>(内部アクセス)および/または <externalSharingModel>(外部アクセス)を更新してください。詳細は references/metadata_api_approach.md を参照してください。

  5. デプロイ前の確認 — デプロイする前に、以下を確認してください:

    • [ ] 外部アクセスが内部アクセスより許容的ではないこと
    • [ ] マスター詳細関連のあるオブジェクトが ControlledByParent を使用していること
    • [ ] リクエストされたアクセスレベルが対象オブジェクトに対して有効であること(references/access_levels.md 参照)
    • [ ] オブジェクト間制約が満たされていること(references/access_levels.md の「オブジェクト間制約」参照)
    • [ ] 対象フィールドが references/access_levels.md に変更不可・固定として記載されていないこと
  6. 更新された設定をデプロイ:

    sf project deploy start --metadata CustomObject:<ObjectName> --target-org <org>
    
  7. デプロイ失敗時の対応(最大 2 回まで) — デプロイが失敗した場合:

    • エラーメッセージを読み、根本原因を特定してください。
    • エラーが値がオブジェクトに対して無効または非サポートであることを示している場合は、中止してください — ユーザーに正確なエラーメッセージと、何が可能で何ができないかを説明してレポートしてください。ユーザーが明示的に別の有効な値を指定しない限り、代替値を試さないでください。
    • エラーが一時的である場合(ネットワークタイムアウト、認証失効)は、1 回だけ再試行してください。
    • 同じ変更に対してデプロイを 2 回以上試みないでください。2 回失敗したら、エラーをレポートし、ローカル編集を破棄(sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>)して、ユーザーに今後の進め方を尋ねてください。
  8. 変更を検証 — フェーズ 1 のステップ 1 のクエリを再実行してください。


ルール・制約

制約 理由
マスター詳細関連のあるオブジェクトは ControlledByParent を使用する必要がある プラットフォームが強制 — 他の値は失敗する
外部アクセスは内部アクセスより許容的にできない Salesforce は外部 > 内部の構成を拒否する
一部のオブジェクトは変更不可・固定 OWD を持つ(例:価格表の外部、ユーザー、活動の外部) プラットフォーム強制 — 事前に不可を説明し、デプロイを試みない
価格表は内部 OWD で Use(読み取り選択)または No Access(アクセスなし)のみ受け付け;外部は常に None 標準アクセスレベル(非公開/読み取り/読み書き)は無効
OWD をより制限的に変更すると共有の再計算がトリガーされる 大規模な組織では相当の時間がかかる — ユーザーに警告
カスタムオブジェクトはデフォルトで作成時に Public Read/Write ユーザーはデフォルトが許容的であることに気付かないかもしれません
マネージドパッケージカスタムオブジェクトの場合、名前空間プレフィックス付き完全 API 名を使用(例:ns__Object__c) 名前空間プレフィックス付きオブジェクトはクエリとメタデータ取得の両方でプレフィックスが必要
クエリ前に常に組織接続を確認 混乱を招くエラーメッセージを防止
変更あたり最大 2 回のデプロイ試行 無制限の再試行を防止 — 2 回失敗したら停止してユーザーにレポート

よくある落とし穴

問題 解決方法
更新時に INSUFFICIENT_ACCESS エラー ユーザーが共有管理権限またはシステム管理者プロファイルが必要
OWD 変更がスタックしているように見える 共有再計算中 — 設定 > 共有設定で進捗を確認
カスタムオブジェクトがクエリで見つからない __c サフィックスを含む完全 API 名を使用してください
ControlledByParent が利用不可 オブジェクトにマスター詳細関連がない — 非公開、読み取り専用、または読み書き可能を使用
外部アクセスフィールドが表示されない 外部共有モデルは外部組織全体デフォルトが有効な場合のみ表示
クエリが結果を返さない オブジェクトがカスタマイズ不可または API 名が正確でない — スペルを確認
価格表の無効な値でデプロイが失敗 価格表は Use/None(内部)のみ受け付け、外部は固定で None — 他の値で再試行しないでください。ユーザーに説明

出力の期待値

納品物:

  • 取得操作の場合: オブジェクト名、内部アクセスレベル、外部アクセスレベルを表示した整形テーブル
  • 更新操作の場合: 変更前後の比較を含む変更確認

スキル間の連携

必要性 委譲先
OWD を制限した後に共有ルールを作成 platform-sharing-rules-generate スキル
メタデータ変更を別の組織にデプロイ platform-metadata-deploy スキル

リファレンスファイル一覧

ファイル いつ読むか
references/access_levels.md OWD アクセスレベル値を検証・説明する場合
references/metadata_api_approach.md Tooling API の代わりにメタデータ API を使用して OWD を更新する場合
examples/get_owd_output.md 整形出力が期待される構造と一致することを確認する場合
examples/update_owd_output.md 更新確認が期待される構造と一致することを確認する場合
原文(English)を表示

Managing Org-Wide Defaults

Retrieve and update Organization-Wide Default (OWD) sharing settings for standard and custom objects in a Salesforce org. OWDs define the baseline level of access users have to records they do not own.

Scope

  • In scope: Retrieving current OWD settings, updating internal/external access levels for standard and custom objects
  • Out of scope: Sharing rules, role hierarchy configuration, manual sharing, permission sets, criteria-based sharing — delegate to appropriate skills

Clarifying Questions

Before proceeding, confirm with the user if not already clear:

  • Which object(s) do you want to get or update OWD settings for?
  • What access level do you want to set? (Private, Public Read Only, Public Read/Write, Controlled by Parent)
  • Do you need to change both internal and external access, or just one?

Required Inputs

Gather or infer before proceeding:

  • Target org: The org alias or username to query/update (use default org if not specified)
  • Object name(s): Standard object API name (e.g., Account, Contact) or custom object API name (e.g., Invoice__c)
  • Operation: Get (retrieve current settings) or Update (change access levels)
  • Access levels (for update): Internal access and/or external access values

Defaults unless specified:

  • Use the default connected org
  • If only one access level is provided, assume it applies to internal access

Workflow

All steps are sequential. Do not skip or reorder.

Phase 1 — Retrieve Current Settings

  1. Query current OWD settings using the Salesforce CLI Tooling API: sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE QualifiedApiName = '<ObjectName>'" --use-tooling-api --target-org <org>

  2. For retrieving all OWD settings at once: sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE IsCustomizable = true ORDER BY QualifiedApiName" --use-tooling-api --target-org <org>

  3. Present results clearly — read references/access_levels.md for valid values and display a formatted table to the user.

Phase 2 — Update Settings (if requested)

  1. Check for immutable/fixed OWD — read references/access_levels.md "Immutable / Fixed OWD Objects" section. If the requested change targets a fixed value (e.g., Price Book external OWD), stop immediately and explain to the user that this value is platform-fixed and cannot be changed by any means. Do not attempt a deploy.

  2. Validate the requested access level — read references/access_levels.md to confirm the value is valid for the target object. If the value is not in the allowed set for that object, explain what values are valid and ask the user to choose one. Do not guess alternative values.

  3. Retrieve the object metadata using the Metadata API (same command for both standard and custom objects): sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>. This retrieves <ObjectName>.object-meta.xml containing <sharingModel> and <externalSharingModel>. See references/metadata_api_approach.md for the full procedure.

  4. Modify the sharing settings — update the <sharingModel> (internal access) and/or <externalSharingModel> (external access) in the object's .object-meta.xml. Read references/metadata_api_approach.md for details.

  5. Pre-deploy verification — before deploying, confirm:

    • [ ] External access is not more permissive than internal access
    • [ ] Objects with Master-Detail relationships use ControlledByParent
    • [ ] The requested access level is valid for the target object (see references/access_levels.md)
    • [ ] Cross-object constraints are satisfied (see "Cross-Object Constraints" in references/access_levels.md)
    • [ ] The target field is not listed as immutable/fixed in references/access_levels.md
  6. Deploy the updated settings: sf project deploy start --metadata CustomObject:<ObjectName> --target-org <org>.

  7. Handle deploy failure (max 2 attempts): If the deploy fails:

    • Read the error message and identify the root cause.
    • If the error indicates the value is invalid or unsupported for the object, stop — report the failure to the user with the exact error message and explain what is and isn't possible. Do not try alternative values unless the user explicitly requests a different valid value.
    • If the error is transient (network timeout, auth expired), retry once.
    • Never attempt more than 2 total deploys for the same change. After 2 failures, report the error, discard local edits (sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>), and ask the user how to proceed.
  8. Verify the change by re-running the query from Phase 1, Step 1.


Rules / Constraints

Constraint Rationale
Objects with Master-Detail relationships must use ControlledByParent Platform enforces this — attempting other values fails
External access cannot be more permissive than internal access Salesforce rejects configurations where external > internal
Some objects have immutable/fixed OWD (e.g., Price Book external, User, Activity external) These are platform-enforced — explain impossibility upfront, never attempt a deploy
Price Book only accepts Use (ReadSelect) or No Access (None) for internal OWD; external is always None Standard access levels (Private/Read/ReadWrite) are invalid for Price Book
Changing OWD to more restrictive triggers sharing recalculation This can take significant time on large orgs — warn the user
Custom objects default to Public Read/Write when created Users may not realize the default is permissive
For managed package custom objects, use the full API name including namespace prefix (e.g., ns__Object__c) Namespace-prefixed objects require the prefix in both queries and metadata retrieval
Always verify the org connection before querying Prevents confusing error messages
Maximum 2 deploy attempts per change Prevents unbounded retry loops — after 2 failures, stop and report to the user

Gotchas

Issue Resolution
INSUFFICIENT_ACCESS error when updating User needs Manage Sharing permission or System Administrator profile
OWD change appears stuck Sharing recalculation is running — check Setup > Sharing Settings for progress
Custom object not found in query Use the full API name including __c suffix
ControlledByParent not available Object has no Master-Detail relationship — use Private, Public Read Only, or Public Read/Write
External access field not showing External sharing model only appears when external org-wide defaults are enabled
Query returns no results Object may not be customizable or API name may be incorrect — verify spelling
Deploy fails with invalid value for Price Book Price Book only accepts Use/None (internal) and external is fixed at None — do not retry with other values, explain to user

Output Expectations

Deliverables:

  • For get operations: Formatted table showing object name, internal access level, and external access level
  • For update operations: Confirmation of the change with before/after comparison

Cross-Skill Integration

Need Delegate to
Creating sharing rules after restricting OWD platform-sharing-rules-generate skill
Deploying metadata changes to another org platform-metadata-deploy skill

Reference File Index

File When to read
references/access_levels.md When validating or explaining OWD access level values
references/metadata_api_approach.md When using Metadata API to update OWD instead of Tooling API
examples/get_owd_output.md To verify formatted output matches expected structure
examples/update_owd_output.md To verify update confirmation matches expected structure

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。