Create a Script Record and Script Deployment Record

In general, before an entry point script can run in your account, you’ll need to create a script record for the script file. You’ll also need to create a script deployment record.

The script deployment record holds part of the logic for when the script runs. Some of that logic is in the script itself, based on the entry point you use. For example, if you use the pageInit(scriptContext) entry point, you’re telling the system to run the script when a page loads. But you also need to say which specific page should trigger the script. In other words, you have to tell the system which record type this script should run on, and you do that with the script deployment record.

You can create these records programmatically, or you can set them up in the UI, as shown in the following steps.

To create the script record and script deployment record:

  1. Go to Customization > Scripting > Scripts > New.

  2. In the Script File dropdown list, select helloWorld.js.

    If you haven’t uploaded the file yet (see Step 3), you can do it right from this page. Point to the right of the dropdown list to see a plus icon. Click the plus icon to open a window where you can upload your file.

  3. After you selected the file, click Create Script Record.

    The system will show a new script record, with helloWorld.js listed on the Scripts subtab.

  4. Fill out the required fields like this:

    • In the Name field, enter Hello World Client Script.

    • In the ID field, enter _cs_helloworld.

  5. Click the Deployments subtab to create the deployment record.

  6. Add a line to the sublist like this:

    • Set the Applies to dropdown to Task. If you want the dialog to show up for a different record type, select that from the list instead.

    • In the ID field, enter _cs_helloworld.

    Leave the other fields as they are. The Status field is set to Testing, which means the script won’t deploy for other users. If you want to make this customization available to everyone later, edit the deployment and set the status to Released.

  7. Click Save.

    The system creates the script and script deployment records.

Related Topics

General Notices