Skip to main content

Content Script action

Runs a script that knows the connected CMS's content model, so it can build and edit content with named types and fields instead of hand-written JSON. In the action picker it is Content Script, under Integration Actions.

It is the built-in Script action plus a content model: same sandbox, same context, same limits, with one extra object the script uses to read and write content. The scripting language itself, and everything that object can do, is covered in Content scripting.

Fields

FieldRequiredDescription
ConnectionYesThe Brightspot connection whose content model the script reads. Nothing the script does with content types works until this is set.
LanguageYesThe script language. Choosing one reveals its Script field, holding the source code. The source is needed to run, not to save: left empty it shows a needs-attention note rather than blocking the save.
Output TypeNoThe shape of the value the script returns, so later steps can reference its fields.
Auto-generate Output TypeNoInfer the output type from the script's result on the last run instead of declaring it by hand. Hidden once an output type is set. Not suited to a differences map, whose keys are record ids from one particular run.

What the script can read

The same two values a plain script step gets—the preceding step's output, and the values you mapped in—plus the object that reaches the content model. The value the script returns becomes the step's output.

A plain Script action has no content model; it is only available where a connection supplies one.

Output

If an output type is declared, the step exposes its fields. A value with no fields to expose—a scalar, a list, or an Object declared with no fields—is offered whole as the step's payload. With no declared type, the output shape is unknown to later steps until the script runs.

A script that builds content typically ends with the differences map a Content action Save takes, which you then map into that step's Differences field. Declare that as an Object with no fields—its keys are record ids, so there is nothing to name. See Returning a value.

Limits

The same ceilings as the built-in Script action: the sandbox has no file system, network, or host access, and bounds how long a script runs and how much memory it uses. Reading the content model costs one call to the connected CMS the first time a script names a type; the result is cached, so repeated runs do not pay it again.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.