ContentAssetUpsert

Use this node to install the binary files (images, etc.) for templates as ContentAssets during app creation. A ContentAsset (entity keyPrefix 03S) is a developer-named, package-friendly handle on top of a ContentDocument/ContentVersion pair. Other templated assets, most notably dashboards, can reference the ContentAsset by its template-level name and have the framework resolve it to the real, app-scoped record at runtime.

Asset Type Name for Rules 

Not supported

Example Definition in chain.json 

1{
2  "name": "create_my_app",
3  "label": "My App",
4  "dominoVariant": "sfdc_internal__UnifiedAnalyticsDominoVariant",
5  "parameters": {},
6  "definition": {
7    "nodes": {
8      "upsert_content_asset_bird": {
9        "graphNodeType": {
10          "name": "ContentAssetUpsert"
11        },
12        "parameters": {
13          "name": "bird",
14          "label": "bird",
15          "language": "en_US",
16          "isVisibleByExternalUsers": false,
17          "file": "contentassets/bird.jpeg"
18        },
19        "sources": [],
20        "runAs": "AutoProc"
21      }
22    }
23  }
24}

Parameters 

ParameterDefinition
name(Required) The template-level asset name.
file(Required) The path to the binary file in the template bundle
label(Optional) The display text for the ContentAsset and used as the ContentVersion Title value. Defaults to name when not provided.
language(Optional) The language for the content. Defaults to en_US.
isVisibleByExternalUsers(Optional) Indicates whether this content is visible to external users (true) or not (false). Defaults to false.
condition(Optional) An EL expression, evaluated at runtime, that determines whether to upload this CSV or not.

Set runAs to AutoProc so that the ContentAsset can upload to the Salesforce Platform. Unlike most node types, this node runs as a system user.

Note

App Context Values 

Content assets created from a template get an entry in the App Context if they are successful. These entries are keyed off of the template specific asset name and contain information about the instance that was created.

App Context ValueDefinition
App.ContentAssets.<templateAssetName>.IdThe ID of the content asset.
App.ContentAssets.<templateAssetName>.NameThe developer name of the content asset.
App.ContentAssets.<templateAssetName>.LabelThe label of the content asset.

On Failure 

If this task fails, it returns a FAIL_TERMINAL status. The chain stops and no downstream nodes run.

Additional Information 

App-Scoped DeveloperName 

ContentAsset.DeveloperName is unique per org. To allow multiple apps installed from the same template to coexist, the task prefixes the requested template name with the owning app’s developer name:

1task specifies: name = "bird"
2app named: MyApp
3stored DeveloperName: MyApp_bird

The unscoped name, bird, is used as the app context key so that other tasks in the same chain can reference the asset without knowing about the per-app prefix. The state entry’s Name attribute holds the fully-scoped DeveloperName, which is what the variable substitution resolves to at install time.

Example dashboard referencing a ContentAsset 

Dashboards include images via an image widget whose source.name is the ContentAsset DeveloperName value. Because the DeveloperName is app-scoped at runtime, the dashboard JSON can’t hard-code the literal name. Instead, it must use the app context for variable substitution:

1"widgets": {
2  "image_1": {
3    "type": "image",
4    "name": "image_1",
5    "parameters": { ... },
6    "source": {
7      "name": "${App.ContentAssets.bird.Name}"
8    }
9  }
10}

The substitution resolves at install time to the DeveloperName attribute of the ContentAsset.

Chain ordering 

The DashboardUpsert`` node must depend on the ContentAssetUpsert` node so the app context entry is populated before substitution runs:

1"nodes": {
2  "upsert_workspace_qa": { 
3    "graphNodeType": {
4      "name": "WorkspaceUpsert"
5    }, 
6    "sources": [], 
7    "runAs": "CurrentUser" 
8  },
9  "upsert_content_asset_bird": {
10    "graphNodeType": {
11      "name": "ContentAssetUpsert"
12    },
13    "sources": ["upsert_workspace_qa"],
14    "runAs": "AutoProc"
15  },
16  "upsert_dashboard_New_Dashboard": {
17    "graphNodeType": {
18      "name": "DashboardUpsert"
19    },
20    "sources": ["upsert_content_asset_bird"],
21    "runAs": "CurrentUser"
22  }
23}

App delete behavior 

Deleting an app removes the installed app from the framework registration but leaves the underlying ContentAsset, ContentDocument, and ContentVersion in the org.

If the app is installed again, the ContentAssetUpsert node detects the orphan ContentAsset and re-links it to the new app.

See Also