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.
-
Go the the Manage page, type 'scripts' in the search bar, and select Scripts:
-
Click + Script:
-
In the pop-up screen, enter a Name, and select a Script type from the list:
WarningYou cannot change the script type after creation. Make sure you choose the correct script type. All scripts are restricted.
-
When your script is created, it appears in the scripts list:
-
Click More options, then click Edit:
-
Enter your script code in the text area, then click Build:
-
Wait for the application to finish building your script.
-
If the build fails, the error message indicates the errors in your script.
NoteIn this case, the script uses a context property that does not exist for the 'Metadata Processing' script type.
-
If the build succeeds, it means your script has no errors. Click Done.
-
Click Publish:
ImportantThe Publish button is only available after the script is built.
NotePublishing the script makes the current version of the code active. Make sure to publish the script for the code changes to take effect.
-
Click the arrow to get back to the Scripts screen:
-
To enable your script, switch the toggle:
NoteEnabling your script makes it available for use.