---
schema_version: "1"
id: 9420bec84694deda94583619936ca5896d3866b1fc0acc7cd1c7ea7abe715c0c
title: SetObjectProperty
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_platformAPISetObjectProperty.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformAPISetObjectProperty.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 19243eca404b34f7425e748864e8cb42b0b369d97e4cd8ef29a90b594be8f38b
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# SetObjectProperty

Sets the value of a property on a specified API object.

## Syntax

`SetObjectProperty(1, 2, 3)`

## Properties

| Ordinal | Type   | Description                                                |
| ------- | ------ | ---------------------------------------------------------- |
| `1`     | String | Required. The name of the object to set a property on.     |
| `2`     | String | Required. The name of the property to specify a value for. |
| `3`     | String | Required. The value to assign to the property.             |

## Example

This code example uses the [Platform.Function.InvokeRetrieve](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformAPIInvokeRetrieve.md) function to perform an API call. The example uses the `Platform.Function.SetObjectProperty` function to specify several properties in the API request, such as the type of object to retrieve and the values of a filter that’s applied to the request. In this case, the filter is configured so that the request retrieves all emails that are associated with a specific account ID.

```
<script runat="server">

    // Create an API RetrieveRequest.
    var RetrieveRequest = Platform.Function.CreateObject("RetrieveRequest");

    // Create a variable to store the result of the RetrieveRequest.
    var StatusAndRequestID = [0,0];

    // Specify the object type for the retrieve request.
    Platform.Function.SetObjectProperty(RetrieveRequest, "ObjectType", "Email");

    // Specify the columns to retrieve for the specified object type.
    Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Email.Name");
    Platform.Function.AddObjectArrayItem(RetrieveRequest, "Properties", "Email.ID");

    // Create a SimpleFilterPart to apply to the API request.
    var RetrieveFilter = Platform.Function.CreateObject("SimpleFilterPart");

    // Filter objects based on account ID.
    Platform.Function.SetObjectProperty(RetrieveFilter, "Property", "Client.ID");
    Platform.Function.SetObjectProperty(RetrieveFilter, "SimpleOperator", "equals");
    Platform.Function.AddObjectArrayItem(RetrieveFilter, "Value", "11223");

    // Add the filter to the RetrieveRequest.
    Platform.Function.SetObjectProperty(RetrieveRequest, "Filter", RetrieveFilter);

    // Perform the request.
    var Emails = Platform.Function.InvokeRetrieve(RetrieveRequest, StatusAndRequestID);

    // Output the status and ID for the request.
    Platform.Response.Write("Status: " + StatusAndRequestID[0] + "<br/>");
    Platform.Response.Write("RequestID: " + StatusAndRequestID[1] + "<br/>");

    // Iterate through the results. Output the ID and name of each object in the result.
    for ( var c = 0 ; c < Emails.length ; c ++ ) {
        Platform.Response.Write("[" + Emails[c].ID + "] ");
        Platform.Response.Write(Emails[c].Name + "<br/>");
    };
</script>
```

The response includes the status and ID of the request, as well as a list of all emails that matched the filter criteria.

```
Status: OK
RequestID: 11d254b9-f4d3-4f05-8b6e-5885ddc0901e
[1122334] Major Release Announcement for version 2.0
[1122335] Minor Release Announcement (version 2.0.1)
[1122336] Minor Release Announcement (version 2.0.2)
```
