Create a new script


All scripts in Sitecore Content Hub are restricted. Unrestricted scripts are obsolete.


We recommend that you keep the total script run time below 10 minutes. After 12 minutes, the script worker considers the script stuck and starts a new worker to relaunch it. This can cause resource starvation and data inconsistency.

  1. Go the the Manage page, type 'scripts' in the search bar, and select Scripts:

  2. Click + Script:

  3. In the pop-up screen, enter a Name, and select a Script type from the list:


    You cannot change the script type after creation. Make sure you choose the correct script type. All scripts are restricted.

  4. When your script is created, it appears in the scripts list:

  5. Click More options, then click Edit:

  6. Enter your script code in the text area, then click Build:

  7. Wait for the application to finish building your script:

    ![Wait for build to finish]

  8. If the build fails, the error message indicates the errors in your script:

    ![Failed build]


    In this case, the script uses a context property that does not exist for the 'Metadata Processing' script type.

  9. If the build succeeds, it means your script has no errors. Click Done:

    Successful build

  10. Click Publish:


    The Publish button is only available after the script is built.


    Publishing the script makes the current version of the code active. Make sure to publish the script for the code changes to take effect.

  11. Click the arrow to get back to the Scripts screen:

  12. To enable your script, switch the toggle:


    Enabling your script makes it available for use.

Do you have some feedback for us?

If you have suggestions for improving this article,