# Save scenarios By default, scenarios created in Workshop are [temporary](../../ontology/temporary-scenario/index.md)—they exist only within the current session and are deleted when the session ends. Saving scenarios enables you to persist them in the Ontology, allowing for reuse across sessions and collaboration with other users. It is often useful to store workflow specific metadata alongside the stored scenario to make organizing and finding relevant stored scenarios easier. To accomplish this, we leverage the Ontology to create objects that represent the stored scenarios. Users can then customize the name, additional properties, and even relationships between the scenario object and other objects. ## Object scenario capabilities Before we can start saving scenarios, we will need to create an object that implements the scenario trait. At minimum, this requires a property to hold the scenario ID and another for the scenario name. We strongly encourage using the primary key and title properties of the object, respectively, for this purpose. ![create-scenario-object](../../../assets/7b5d282f2e3fb14882d9e3d6f98cf362889ed116163c715a9332ab9384f0173d.webp) You can also add other properties to hold additional information about the scenario such as `Created By` or `Description`. In the properties tab of your scenario object, select your ID property and add the type class `scenarios:versioned-scenario-rid` as shown below. ![configure-scenario-id-type-class](../../../assets/32d1e6c14466367fc21639cfe098276e60a95f6aefa267e460225fd1ede05498.webp) Then select your name or title property and add the type class `scenarios:scenario-name`. ![configure-scenario-name-type-class](../../../assets/d78555545467cac813817cc0735dc666d0f377dc20e43b6c79841d53c335b418.webp) Your scenario object is now ready to store saved scenarios, but before you can save scenarios to this object in Workshop, you will need to set up an Action that creates objects of this type. ## Scenario Actions In addition to a scenario object, we need to have Actions that create and update scenario objects to use in Workshop when saving scenarios. ### Create scenario Action We start by creating an Action that produces an object that implements the scenario trait. ![create-scenario-action](../../../assets/285b586fdfd9a6021c90429f9681b382b842da8e0c50787a4e528c819757484c.webp) In the **Rules** tab, add properties that need to be provided during the creation of a scenario. At a minimum, the scenario's `Scenario Id` and `Name` properties must be added. ![create-scenario-action-rules](../../../assets/98a761814558a5bf0afbdec0b5f3a85a27db4b9fddfa1828049c84b7a62f77c8.webp) Now we need to ensure that the `Scenario ID` and `Name` properties have the correct type class. In the **Forms** tab, we can remove the scenario object from the list of properties since the action we are making creates a new scenario. Create a new string property named `Scenario Id`. ![create-scenario-action-id](../../../assets/da7d4dbc76cfa68ac4d70a23c432c220378f035f6e229a396a14d58f464d4867.webp) In the **Details** tab, add the type class `scenarios:versioned-scenario-rid`. ![create-scenario-action-id-typeclass](../../../assets/8a3cfbdf1eb893c63c1249b8adaf478d0ed3388043950ae47d58188c94a53554.webp) For the Action property that sets the scenario name, add the type class `scenarios:scenario-name` if it is not already set. In the **Rules** tab, the `Scenario ID` can now be set to the recently created string value. ![create-scenario-action-id-rule](../../../assets/3b6907d280f32a8be4014c93c7a16e61608bacac568cf1b1bc10b5834ed77616.webp) ### Update scenario Action Next, we will create an Action that updates an object that implements the scenario trait. ![update-scenario-action](../../../assets/9eec2b5ac1e3003f1c01b8771d6e2b4da372edc0c79291dcb398cab5b74a330c.webp) In the **Rules** tab, add a `Name` property. ![update-scenario-action-rules](../../../assets/d76c2826608675849473371ef134ecc34c4b0ced079e48983d05087e70466243.webp) In the **Forms** tab, add the type class `scenarios:scenario-object-locator` to the Action property that determines the scenario object to be modified. ![update-scenario-action-locator-type-class](../../../assets/9d3e4c294cad5dcc9d42121a8ba2ed6b0908b19f17914ee8e50f8a44d329c3af.webp) For the Action property that updates the scenario name, add the type class `scenarios:scenario-name` if it is not already set. The scenario object and Actions are now ready to be used in Workshop to save and update stored scenarios. ## Configure a Save Scenario button We will enable saving scenarios from a button in the core button group widget. To start, we have added a new button to our button group and selected the "Save Scenario" event on click. ![configure-save-scenario-event](../../../assets/52f64a18dfaba27dbd1b6f3542442a072e3ca4c5791dee604c51144ce6bb5380.webp) In order to save to an object, we must select an object type that implements the scenario trait. ![select-create-scenario-object-type](../../../assets/22ca2e2de0d323af62a3aa205eb18d121773d4c1a42f3ea3051e1aa58836e545.webp) After selecting an object type, we must select an Action that creates scenario objects of that type. If the type classes for the Action parameters are configured properly, then the Scenario ID and name parameters should be automatically filled in (as shown below). Other Action parameters can be configured the same way as other Actions in Workshop, so you can set default values or leave them blank for the user to fill in. ![create-scenario-action-verify-type-classes](../../../assets/9ebaba459572dc6366b5335d00b84472486691f0e81312587715964ccef4c7d5.webp) For example, you can use the `Current user` special variable to populate a `created by` parameter. ![create-scenario-action-user](../../../assets/50df9031a912b31d039c7d6d0fa43e330c2cb583b26c1a239dcd2f9c871dc49b.webp) With the Create and Update Actions configured, the widget now allows users of the module to save scenarios. ## Saving scenarios as a user Users can save newly created scenarios as well as update existing scenarios using the configured save button. Additionally, in the Scenario manager when a scenario has been created but not yet saved the scenario will show the “New” tag until it has been saved, or "Updated" if the scenario has previously been saved and modified. ![create-new-scenario](../../../assets/a2445e3f4ed576f92d9380bd8b81a8ceb7637d0e2fcda9ac680629d853c57697.webp) When saving a new scenario, this will open the Create scenario action dialog. The name and scenario ID will be automatically filled in, and the user will have the opportunity to enter or change values for any additional action parameters. In this case, the example includes a description field that the user may populate to save along with the scenario. ![create-scenario-action-dialogue](../../../assets/afc56f39a62d2f169e5284e628f74541d9609f21e77a0adb46b3bbe48708c549.webp) After clicking **Submit**, the Scenario will be saved and will no longer show a "New" indicator. ![successfully-saved-scenario](../../../assets/80aa0424781e9afed03762be2d177b86e383059cf72592aaf78c4133f6d92da7.webp) At this point, the scenario has been saved, but it will not be loaded by default when visiting this application unless configured to do so. See the [Loading scenarios](../scenarios-load/index.md) tutorial to learn how to configure this behavior. ## Save scenarios without the editor role If you are facing issues saving your scenarios within your Workshop Module, this may be because your Foundry permissions are missing the Editor role. This is an issue specifically if you want to enable saving scenarios in a Workshop module without having to grant edit permissions on the module. This should not be an issue if you do not plan to save your scenario. For this issue, contact your Palantir representative to (1) create a “Viewer with Create Scenarios” role and (2) update the Viewer items checked in the second image below. ![viewer-with-create-scenarios](../../../assets/7d3502af0ca85e14d41dc2324addea7410afb9ac20b2c99253fa11f442bd012b.webp) ![viewer-checkboxes](../../../assets/297092d02517cfab739c08bbe1758fe9674e152c2c60a5f514db32d14e34f51d.webp)