Script types
All scripts in Sitecore Content HubTM are restricted. Unrestricted scripts are obsolete.
Sitecore Content HubTM offers the following script types:
-
User sign-in scripts:
User sign-in scripts are executed every time a user logs into the application.
Warning- The User sign-in script might lock users out when there are inconsistent user validations in the script or any other runtime errors. This includes superusers and administrators.
- This lock-out can be resolved by de-activating the script using the REST API or SDK.
-
User pre-registration scripts:
User pre-registration scripts are executed every time a new user is created.
NoteUser pre-registration scripts are executed before the new user is created.
-
User post-registration scripts:
User post-registration scripts are executed every time a new user is created.
NoteUser post-registration scripts are executed after the new user is created.
-
Metadata processing script:
Metadata processing scripts are executed every time an asset is processed by the processing worker.
-
Action scripts:
Action scripts are the only type of scripts that can be used by Actions and Triggers. They are the most commonly used scripts due to their capacity to cover multiple use cases.
When used with Triggers, Actions can execute Action scripts either In Process (immediately) or In Background.
WarningIn Process Action scripts should not be used for UI-related interactions or any time consuming operations.
The In Process Action scripts can be executed during multiple phases:
-
Pre-commit:
In this phase, Action scripts are executed before the triggering event's execution. For example, if the triggering event is 'Entity modification', the Action script is executed before the entity is modified.
TipPre-commit Action scripts can be used to populate default values.
ImportantThe Pre-commit phase is the only phase where scripts can modify the event's data.
-
Security:
In this phase, Action scripts are executed when the application asserts the triggering user's permissions. For example, if the triggering event is 'Entity modification', the Action script is executed when the application asserts that the triggering user is allowed to modify the entity.
TipSecurity Action scripts can be used to perform additional security checks and to throw a SecurityException.
-
Validation:
In this phase,Action scripts are executed when the application validates the triggering event's data. For example, if the triggering event is 'Entity modification', the Action script is executed when the application validates the entity's modified values.
TipValidation Action scripts can be used to perform additional validations and to throw a ValidationException.
-
Audit:
In this phase, Action scripts are executed after the triggering event's data is finalized.
TipAudit Action scripts can be used to log audit messages to internal or external logging systems.
-
Post:
In this phase, Action scripts are executed after the triggering event is finalized.
-