platform-dataspace-access-configure
Configure DataSpace access in Salesforce Data Cloud using a two-layer model:
- DataSpace-level access — grant a access to a DataSpace by embedding a element in the permission set XML and deploying via MDAPI.
- Object-level access (optional) — grant that permission set access to specific DMO / DLO / CIO objects within the DataSpace using the Object Access Grants Connect API.
The MDAPI layer is required to establish the PermissionSet → DataSpace linkage. The Connect API layer is optional and only needed when access should be scoped to specific objects rather than governed entirely by data governance policies.
Decide the Case First
Pick exactly one case from the table below before writing any files. Each case has a different output shape.
| Case | User intent | Permission set state | Files to emit |
|---|
| A. Create new permset with DS access | "create a permission set called X with dataspace scope Y" | does NOT exist yet | permissionsets/<Name>.permissionset-meta.xml
and |
| B. Add DS access to existing permset | "grant existing permission set X access to dataspace Y" | already deployed (may contain other permissions) | patched permissionsets/<Name>.permissionset-meta.xml
and — see Case B workflow below |
| C. Object-level grant only | "grant permset X access to object Z (in dataspace Y)" — permset + scope already configured | already deployed with | (Connect API body). NO permission set XML, NO |
Only emit the files listed for the case you picked. Emitting Case A/B files for a Case C prompt (or vice versa) is a correctness failure — extra files change the deployment shape.
Case B — critical: PermissionSet MDAPI deploy is a
full metadata replace. Every
,
,
,
,
<applicationVisibilities>
,
,
,
,
,
<customMetadataTypeAccesses>
,
,
<externalDataSourceAccesses>
element you omit from the redeploy is
deleted from the org. Before adding
to an existing permset, retrieve the current XML and patch it — do not hand-author from scratch.
Case B workflow
- Retrieve the existing permission set:
bash
sf project retrieve start --metadata PermissionSet:<Name> --target-org <alias>
- Open the retrieved
permissionsets/<Name>.permissionset-meta.xml
. Keep every element already there.
- Insert the block for the target DataSpace (element order in the file does not matter for MDAPI). If the file already has a block for this same DataSpace, replace only that block. Leave every block for other DataSpaces untouched — one block per DataSpace, and removing a block revokes that DataSpace grant.
- Write listing the permset in .
- Redeploy with .
When This Skill Owns the Task
Trigger this skill when the user wants to:
- Create a permission set that grants access to a Data Cloud DataSpace
- Add or modify on an existing permission set
- Grant a permission set access to specific DMO / DLO / CIO objects in a DataSpace
- Configure and for a DataSpace scope
- List or remove object access grants for a permission set + DataSpace pair
Delegate elsewhere when:
- The permission set has no DataSpace access at all →
platform-permission-set-generate
- The task is creating the DataSpace itself →
- The task is ingesting data or configuring streams →
Layer 1 — DataSpace-Level Access (MDAPI)
Embed a
element inside the
XML. Deploy with MDAPI.
xml
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Data Cloud Analyst</label>
<description>Data cloud analyst access to the default dataspace</description>
<hasActivationRequired>false</hasActivationRequired>
<dataspaceScopes>
<dataspaceScope>default</dataspaceScope>
<dataAccessLevel>ALL</dataAccessLevel>
<objectAccessLevel>BY_POLICY</objectAccessLevel>
</dataspaceScopes>
</PermissionSet>
Element Rules
| Element | Required | Valid Values | Purpose |
|---|
| yes | parent element (plural) | Container for a single dataspace scope grant |
| yes | DataSpace API name (e.g. ) | Which DataSpace this grant is for |
| yes | , , | Row-level data access within the DataSpace |
| yes | , | Object-level access. defers to data governance policies. is only allowed when is |
Common Mistakes
- Wrong parent name — using instead of . Deployment fails silently or with cryptic errors.
- Wrong child name — using instead of .
- Wrong enum values — / / / are not valid. Use , , or for ; use or for . See Element Rules table for allowed combinations. Deployment error means invalid enum.
- Multiple scopes in one element — grants access to exactly one DataSpace. To grant access to multiple, add multiple blocks.
Package Layout (Case A and Case B)
A deployable bundle for Layer 1 always contains both files:
text
<output-root>/
package.xml
permissionsets/<Name>.permissionset-meta.xml
(required — list every permission set being deployed in
):
xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Data_Cloud_Analyst</members>
<name>PermissionSet</name>
</types>
<version>67.0</version>
</Package>
Deploy:
bash
sf project deploy start --source-dir force-app/main/default/permissionsets/ --target-org <alias>
Layer 2 — Object-Level Access (Connect API) — Case C
Only needed when
is not
, or when governance policies do not cover the target objects. Grants are runtime —
no MDAPI deploy, no , no permission set XML. The only artifact for a Case C task is a single
describing the Connect API call.
Resolve the API version first
Every Connect API
in this layer contains an
/services/data/v<apiVersion>/…
segment.
Do not hardcode . Resolve the target org's actual API version before writing the envelope so the request matches the org's supported surface:
bash
sf org display --target-org <alias> --json | jq -r '.result.apiVersion'
- Substitute the returned value (e.g. , ) into the as .
- If the org can't be queried (offline authoring, no alias yet), fall back to the from this skill's frontmatter () — the endpoint was introduced there and any newer version accepts the same body.
- If the user explicitly specifies a version in the prompt, use that verbatim.
In the templates below,
is a placeholder. Replace it with the resolved API version (e.g.,
,
) before emitting
.
— canonical shape
Emit the request as a self-describing envelope with
,
,
,
, and
. Do NOT emit only the body — reviewers and downstream tooling read the envelope.
json
{
"method": "POST",
"endpoint": "/services/data/v{apiVersion}/ssot/data-governance/object-access-grants",
"headers": {
"Content-Type": "application/json"
},
"body": {
"permissionSetName": "Data_Cloud_Analyst",
"dataSpaceName": "default",
"objectApiName": "Account__dlm"
},
"expectedResponse": {
"status": 201,
"body": {
"permissionSetName": "Data_Cloud_Analyst",
"dataSpaceName": "default",
"objectApiName": "Account__dlm"
}
}
}
Bulk Grant
Same
envelope shape.
gains the
suffix,
is replaced by the list-valued
, and
omits the
field because bulk responses return per-object status entries rather than the flat request payload (see Gotchas below).
json
{
"method": "POST",
"endpoint": "/services/data/v{apiVersion}/ssot/data-governance/object-access-grants/actions/bulk-create",
"headers": {
"Content-Type": "application/json"
},
"body": {
"permissionSetName": "Data_Cloud_Analyst",
"dataSpaceName": "default",
"objectApiNames": ["Account__dlm", "Contact__dlm", "Opportunity__dlm"]
},
"expectedResponse": {
"status": 201
}
}
List Grants
Same envelope shape with
, query parameters on the
, and no
.
json
{
"method": "GET",
"endpoint": "/services/data/v{apiVersion}/ssot/data-governance/object-access-grants?permissionSetName=Data_Cloud_Analyst&dataSpaceName=default",
"headers": {
"Accept": "application/json"
},
"expectedResponse": {
"status": 200
}
}
Revoke Grant
Same envelope shape with
, the object API name as a path segment, and
expectedResponse.status: 204
(No Content).
json
{
"method": "DELETE",
"endpoint": "/services/data/v{apiVersion}/ssot/data-governance/object-access-grants/Account__dlm?permissionSetName=Data_Cloud_Analyst&dataSpaceName=default",
"headers": {
"Accept": "application/json"
},
"expectedResponse": {
"status": 204
}
}
Object Types
- DMO (Data Model Object) — unified profile objects, suffix
- DLO (Data Lake Object) — raw ingested data, suffix
- CIO (Calculated Insight Object) — computed metrics, suffix
Combined Setup — Case A + Case C from a Cold Start
Use this section ONLY when the user is starting from nothing and asks for both the permset+scope AND per-object grants in a single request. If the user's prompt is only about the Connect API grant (Case C) — for example "grant Account__dlm access; the permset and dataspace scope already exist" — SKIP this section entirely and emit only
from Layer 2.
The commands below are operator-facing
CLI invocations (a runnable cold-start walkthrough), NOT the artifact you emit. For a normal Case C task the artifact is a single
envelope as documented in Layer 2 above.
Goal: Grant
permission set access to
and
in the
DataSpace.
Step 1 — Deploy PermissionSet with DataSpace scope (MDAPI):
xml
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Data Cloud Analyst</label>
<description>Data cloud analyst access to the default dataspace</description>
<hasActivationRequired>false</hasActivationRequired>
<dataspaceScopes>
<dataspaceScope>default</dataspaceScope>
<dataAccessLevel>ALL</dataAccessLevel>
<objectAccessLevel>BY_POLICY</objectAccessLevel>
</dataspaceScopes>
</PermissionSet>
bash
sf project deploy start --source-dir permissionsets/ --target-org <alias>
Step 2 — Grant object access (Connect API):
(Required here because the DataSpace has no governance policies covering and . Skip Step 2 when policies already govern the target objects — Layer 1 alone is sufficient.)
Resolve the org's API version first (see
Resolve the API version first above), then substitute it into the
value:
bash
API_VERSION=$(sf org display --target-org <alias> --json | jq -r '.result.apiVersion')
sf org api rest --target-org <alias> \
--method POST \
--path "/services/data/v${API_VERSION}/ssot/data-governance/object-access-grants/actions/bulk-create" \
--body '{
"permissionSetName": "Data_Cloud_Analyst",
"dataSpaceName": "default",
"objectApiNames": ["Account__dlm", "Contact__dlm"]
}'
Step 3 — Verify:
bash
sf org api rest --target-org <alias> \
--path "/services/data/v${API_VERSION}/ssot/data-governance/object-access-grants?permissionSetName=Data_Cloud_Analyst&dataSpaceName=default"
Rules and Constraints
| Rule | Reason |
|---|
| Use (plural) as parent, (singular) as child | XML schema requirement; other names deploy-fail |
| values: , , only | Other values (e.g. , ) are rejected |
| values: , only | Other values (e.g. , , ) are rejected. requires dataAccessLevel=CONTROLLED_BY_PARENT
|
| Prefer when data governance policies exist | Delegates row/column filtering to central policy — no per-object grants needed |
| One block per DataSpace | Repeat the block for multiple DataSpaces on the same permission set |
| Org must have Data Cloud provisioned to deploy | On non-Data-Cloud orgs, the element is ignored or rejected |
| Do not query / via SOQL | Not queryable; use MDAPI retrieve to inspect existing grants |
Gotchas
| Issue | Resolution |
|---|
| Deployment fails with error | Check enum values — must be //; must be / |
| Permission set deploys but users still can't query DataSpace data | Layer 2 not applied — objects need explicit grants if objectAccessLevel != BY_POLICY
|
| Bulk-create returns for some objects | Idempotent — safe to retry; response shows per-object status |
| Connect API returns 404 for object grants endpoint | Org lacks Data Cloud provisioning, or the resolved API version is below the minimum. The endpoint was introduced in — re-run to confirm the org's field is or later, and substitute that value into the path |
| Retrieved PermissionSet XML shows different element names than deployed | Metadata API sometimes echoes legacy names on retrieve — always author with current names |