---
schema_version: "1"
id: 6ee7d261b1c95f74f14199e53d915099277ab184bb65a0513e66e3ea8c97959f
title: REQUIRESCRIPT
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_requirescript.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_requirescript.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 57e5aaba66aeeca5e64cb9559478958f5c2cea8464d2386be57f202c2c9719e4
description: Returns a script tag with URL source that you specify. Use this function when referencing the Lightning Platform AJAX Toolkit or other JavaScript toolkits.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# REQUIRESCRIPT

Returns a script tag with URL source that you specify. Use this function when referencing the Lightning Platform AJAX Toolkit or other JavaScript toolkits.

## Use

`{!REQUIRESCRIPT(url)}` and replace url with the link for the script that is required.

For the AJAX Toolkit:

```
{!requireScript("/soap/ajax/13.0/connection.js")}
```

Returns:

```html
<script src="/soap/ajax/13.0/connection.js"></script>
```

## Tips

- Use global variables to access special merge fields for s-controls.
- Use this function when creating custom buttons or links where you have set Behavior to "Execute JavaScript" and Content Source to "OnClick JavaScript" because the script tag must be outside the OnClick code.
- This function is only available for custom buttons and links that have Content Source set to "OnClick JavaScript."
- When working in Visualforce, use INCLUDESCRIPT instead.

![Custom Button Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Custom Button Example

```
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var c = new sforce.SObject("Case");
c.id = "{!Case.Id}";
c.Status = "New";
result = sforce.connection.update([c]);
window.location.reload();
```

This example sets the Status of a case to “New” whenever a user clicks a custom button from the case detail page. To set up this code in your organization, define a custom button for cases that has the following attributes:

- Display Type is “Detail Page Button”
- Behavior is “Execute JavaScript”
- Content Source is “OnClick JavaScript”

Next, paste this example code into your custom button definition and add it to your case page layouts.