---
schema_version: "1"
id: 76127462e9c64ba9847dfb163297f6a0fb0ee476c1c3c1c1196a44dd46eb58bc
title: SetValue
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_platformAMPscriptVariableSetValue.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformAMPscriptVariableSetValue.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9a06305d5439e0fff96990cc4d6eb2a77d2b2310a1e5c8fd03fd6ed9fb434593
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# SetValue

## Overview

Returns the value from the specified AMPscript variable in the current script context

### Syntax

SetValue(1, 2)

### Function Properties

<!--complex table-->

| Ordinal | Type   |              | Description                         |
| ------- | ------ | ------------ | ----------------------------------- |
| **1**   | string | **Required** | AMPscript variable containing value |
| **2**   | string | **Required** | Value passed to AMPscript variable  |

## Example

```
<script runat=server>
     Platform.Variable.SetValue("@exampleVariable","exampleValue");
</script>
```
