# Pass an object set from Workshop to Slate

**URL:** <https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943>\
**Category:** Ask the Community\
**Tags:** workshop, slate\
**Created:** [August 6, 2024, 12:39pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943 "2024-08-06T12:39:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimonH](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/simonh/32/666_2.png) [@SimonH](https://community.palantir.com/u/SimonH)\
**Post date:** [August 6, 2024, 12:39pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/1 "2024-08-06T12:39:47Z")

</div>

I have a simple Slate app which is supposed to render items in a calendar. I also have an object type with a timestamp property. I now use workshop to identify the relevant objects in question. An iframe is then used in Workshop to bring in the Slate App. The relevant objects are passed in as object set:

![2024-08-06_14-33-33](https://canada1.discourse-cdn.com/palantir/original/2X/5/512201ef037bf82a842c816e02187b2d51c915b1.png)

In Slate I have a getMessage event defined with the following code to read the object set into a variable.

```javascript
const payload = {{slEventValue}};
console.log(payload["events"]);
return payload["events"];

```

Now, the challenge is to access the objects in Slate. Instead of a list of objects from where I can access “\<object\_set\>.data.property” I get a weird structure, such as

```JSON
{
    "filtered": {
        "objectSet": {
            "searchAround": {
                "objectSet": {
                    "searchAround": {
                        "objectSet": {
                            "static": {
                                "objectRids": [
                                    "ri.phonograph2-objects.main.object.0000-11111-2222-3333-4444-5555"
                                ]
                            },
                            "type": "static"
                        },
                        "relationId": "abc",
                        "relationSide": "SOURCE"
                    },
                    "type": "searchAround"
                },
                "relationId": "xyz",
                "relationSide": "SOURCE"
            },
            "type": "searchAround"
        },
        "filter": {
            "relativeTimeRange": {
                "propertyId": "start",
                "propertyIdentifier": null,
                "sinceRelativeMillis": 0,
                "untilRelativeMillis": null
            },
            "type": "relativeTimeRange"
        }
    },
    "type": "filtered"
}

```

How to I access the actual objects in Slate? What step am I missing?

---

<div class="post-metadata">

**Author:** ![MaxiM](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/maxim/32/995_2.png) [@MaxiM](https://community.palantir.com/u/MaxiM)\
**Post date:** [August 6, 2024, 8:06pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/2 "2024-08-06T20:06:15Z")

</div>

To retrieve the data from your ObjectSet in Foundry, you’ll need to use the ‘Get Objects’ endpoint from the Object Storage Service in Phonograph2. Here’s a typical workflow:

1. Pass the ObjectSet from Workshop to a variable in Slate. Use a function to store your objectSet definition. You can pluck the objectSet definition from Workshop directly for testing - example: `

```auto
{
  "type": "filtered",
  "filtered": {
    "objectSet": {
      "type": "base",
      "base": {
        "objectTypeId": “your-object-type-id”
      }
    },
    "filter": {
      "type": "and",
      "and": {
        "filters": [
          {
            "type": "or",
            "or": {
              "filters": [
                {
                  "type": "exactMatch",
                  "exactMatch": {
                    "propertyId": “your property”,
                    "terms": [
                      “Someterm”,
                      “Someterm2”
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

```

1. Use the ObjectSetService’s ‘Get Objects Page’ endpoint to obtain the object RIDs (Resource Identifiers).

2. Utilize the Object Storage Service’s ‘Get Objects’ endpoint in Phonograph2 to fetch the actual data using these RIDs.

An alternative approach is to use a TypeScript function to resolve the JSON of the returned objects directly.

---

<div class="post-metadata">

**Author:** ![comew](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@comew](https://community.palantir.com/u/comew)\
**Post date:** [August 7, 2024, 8:35am UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/3 "2024-08-07T08:35:24Z")

</div>

A similar approach would be to use ObjectSetService’s `Create Temporary Object Set` endpoint, with the following argument:

```auto
{
  objectSet: {
    "type": "filtered",
    "filtered": {...}
  },
  timeToLive: "ONE_DAY",
  objectSetFilterContext: {}
}

```

Then it will return a response like:

```auto
{
  "objectSetRid":"ri.object-set.main.temporary-object-set.1234"
}

```

And you can use this objectSetRid in the platform tab to create a new object set.

 ![image](https://canada1.discourse-cdn.com/palantir/original/2X/8/870600f4858cb141203ceb2c1ea9e271187074ff.png)

I find that object sets created via the platform tab can be easier to use than the format of what other endpoints return.

---

<div class="post-metadata">

**Author:** ![sirnyls](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/sirnyls/32/827_2.png) [@sirnyls](https://community.palantir.com/u/sirnyls)\
**Post date:** [August 7, 2024, 12:59pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/4 "2024-08-07T12:59:59Z")

</div>

> [@SimonH](#):
>
> have a simple Slate app which is supposed to render items in a calendar. I also have an object type with a timestamp property.

Is it also possible to do it the other way round, i.e. receive data from slate in workshop?

---

<div class="post-metadata">

**Author:** ![bkaplan](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@bkaplan](https://community.palantir.com/u/bkaplan)\
**Post date:** [August 7, 2024, 6:46pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/5 "2024-08-07T18:46:32Z")

</div>

Yes this is possible by setting an output parameter ([docs](https://www.palantir.com/docs/foundry/workshop/widgets-iframe/#output-parameters))

---

<div class="post-metadata">

**Author:** ![SimonH](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/simonh/32/666_2.png) [@SimonH](https://community.palantir.com/u/SimonH)\
**Post date:** [August 8, 2024, 10:01am UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/6 "2024-08-08T10:01:12Z")

</div>

Thank you, Maxi.

Unfortunately, I only get an error message, when I try to plug in the Message Payload into the “Get Objects Page” request.

> {“errorCode”:“INVALID\_ARGUMENT”,“errorName”:“Default:InvalidArgument”,“errorInstanceId”:“475bd0b8-b754-4534-a56c-1be7adccb59e”,“parameters”:{}}

---

<div class="post-metadata">

**Author:** ![MaxiM](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/maxim/32/995_2.png) [@MaxiM](https://community.palantir.com/u/MaxiM)\
**Post date:** [August 8, 2024, 10:39am UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/7 "2024-08-08T10:39:46Z")

</div>

@comew - I like this approach but the only downside is that a Palantir administrator has to expose the versionedObject endpoint to slate, which I don’t have available in my instance.

@SimonH  
This is the structure of my call to the getObjectsPage endpoint

For reference this is the endpoint Slate

Get Objects Page  
PUT  
/objectSets/objects  
Fetches object rids on requested page of evaluated object set. If more objects are available, the returned pageToken can be used to fetch the subsequent page. Note that page tokens are _not_ long-lived and _may_ get invalidated (for example following updates to the underlying index or indices, or after a few minutes). Note that the service currently does not provide guarantees around the consistency of returned results. In particular, any state changes to the underlying indices can cause duplicate results to be returned or some results to be skipped between subsequent page requests.

```auto
#
{
  "objectSet": "{{f_my_object_set}}",
  "pageSize": 50,
  "sort": [
    {
      "propertyId": "myproperty",
      "sortOrder": "ASCENDING"
    }
  ]}

```

And my function is:

```auto
var data = {{v_ObjectSet}}

return data

```

---

<div class="post-metadata">

**Author:** ![SimonH](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/simonh/32/666_2.png) [@SimonH](https://community.palantir.com/u/SimonH)\
**Post date:** [August 8, 2024, 12:26pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/8 "2024-08-08T12:26:33Z")

</div>

Unfortunately, I also get an error message with your code:

> {“errorCode”:“INVALID\_ARGUMENT”,“errorName”:“Default:InvalidArgument”,“errorInstanceId”:“3c4aaeee-a895-4446-a3c4-79b240c9bd24”,“parameters”:{}}

---

<div class="post-metadata">

**Author:** ![SimonH](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/simonh/32/666_2.png) [@SimonH](https://community.palantir.com/u/SimonH)\
**Post date:** [August 8, 2024, 12:42pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/9 "2024-08-08T12:42:13Z")

</div>

> [@MaxiM](#):
>
> ```auto
> {
> "objectSet": "{{f_my_object_set}}",
> "pageSize": 50,
> "sort": [
> {
> "propertyId": "myproperty",
> "sortOrder": "ASCENDING"
> }
> ]}
> 
> ```

Okay, in the first step I am able to retrieve the object RIDs (not sure why you go through a function. I use the variable directly and that also works). Now I try to use Phonograph2 API and tried to get a single object (Get Object). However, I get an error about the object type not being registered. Could it be an issue with OSv2 (which I am using)?

> {“errorCode”:“INVALID\_ARGUMENT”,“errorName”:“Phonograph2:ObjectTypesNotRegistered”,“errorInstanceId”:“3e24f759-0e3e-473e-ab55-1cfe214379a6”,“parameters”:{“objectTypeIds”:“[some-object-type-id]”}}

---

<div class="post-metadata">

**Author:** ![MaxiM](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/maxim/32/995_2.png) [@MaxiM](https://community.palantir.com/u/MaxiM)\
**Post date:** [August 9, 2024, 11:10am UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/10 "2024-08-09T11:10:36Z")

</div>

Apologies @SimonH for lack of clarity

For Objects synced in the ObjectSetServiceV1 then the endpoint in slate to use to convert a list of objectrids into a readable form is:

 ![Screenshot 2024-08-09 at 10.04.09 AM](https://canada1.discourse-cdn.com/palantir/original/2X/2/23ac017cdb9fb29f592cb66465fe7ca8fe359f63.png)

However for Objects synced using OSv2 the correct service to use to convert the objectRids is

 ![Screenshot 2024-08-09 at 10.06.00 AM](https://canada1.discourse-cdn.com/palantir/original/2X/b/b5fca8e39c6af25e2d72fce7d7bcfebce6cc25b4.png)

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [January 18, 2025, 4:19pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/11 "2025-01-18T16:19:00Z")

</div>

Automatically bumped on January 18, 2025, 4:19pm UTC



---

<div class="post-metadata">

**Author:** ![vraja](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@vraja](https://community.palantir.com/u/vraja)\
**Post date:** [March 12, 2025, 5:49pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/12 "2025-03-12T17:49:20Z")

</div>

Another way would be to pass the ids as a string from workshop to slate. And then re-create the object set in slate based on the ids.

1. Create an array of ids of the object set.  

2. Convert the array of ids into a string (so that it can be passed in as an input variable to the slate).  
Foo:

```auto
@Function()
public arrayToString(arr: Array<string>): string {
    return JSON.stringify(arr);
}

```

 ![Screenshot 2025-03-12 at 13.27.29](https://canada1.discourse-cdn.com/palantir/original/2X/2/20579d04472bb5f87e9a05c83136c734acacb9b4.png)

1. Pass the string ids variable into your slate as an input parameter (not a url parameter) with the key `ids_string`.

2. Define a variable in slate that will hold your ids. We’ll call this `ids`.

3. Receive the `ids_string` input parameter in slate and set the `ids` variable by creating a new event and action with event `slate.getMessage` and action `ids.set`.  

```auto
const payload = {{slEventValue}}
const ids = payload["ids_string"];
const ids_array = JSON.parse(ids);
if (ids_array.length === 0){
    return [""]
}
return ids_array

```

1. Define your object set.  
 ![Screenshot 2025-03-12 at 13.40.57](https://canada1.discourse-cdn.com/palantir/original/2X/4/42efa88741af23987d9ff3949264a9c18658e304.png)

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [October 27, 2025, 11:33pm UTC](https://community.palantir.com/t/pass-an-object-set-from-workshop-to-slate/943/13 "2025-10-27T23:33:38Z")

</div>

Automatically bumped on October 27, 2025, 11:33pm UTC


