Logan Rhyne
Logan Rhyne

Reputation: 601

How do pass in a default Object or list of Objects into a Slate Action widget parameter?

I have an Action with an Object parameter that takes in one or more objects for a "bulk edit". I want to provide a default selection in the Slate Action widget, but all the configuration provides as a hint is: List of Object Locators: [Example Data] Route Alert

What's an 'ObjectLocator' and what format do I need to provide to have the prefill work as expected?

Upvotes: 0

Views: 318

Answers (1)

Logan Rhyne
Logan Rhyne

Reputation: 601

The ObjectLocator is a data structure used in some Foundry endpoints to identify specific objects by their type and primary key value. A single ObjectLocator takes the form of:

{
   "typeId": "objectTypeId",
   "primaryKey": {
      "primaryKeyPropertyId": "value"
    }
}

You can find the objectTypeId value as well as the primaryKeyPropertyId value from the Overview page for the Object Type in question in the Ontology Management App.

If your Action object parameter has the "Allow multiple" option selected, you'll need to pass a list of ObjectLocators like this, to set the default value:

[{
   "typeId": "objectTypeId",
   "primaryKey": {
      "primaryKeyPropertyId": "value"
    }
},{
   "typeId": "objectTypeId",
   "primaryKey": {
      "primaryKeyPropertyId": "value"
    }
}]

Upvotes: 0

Related Questions