palantir-foundryfoundry-workshop

How to use promoted variables in Workshop modules while opening them in Carbon workspaces?


We have a Workshop module that is often accessed by users in two different ways:

The most useful initial layout (which is controlled via a boolean variable, currently linked to a tickbox widget in the module) depends on the way a user accesses this module.

We see functionality that allows us to generate a url with promoted variables, thus allowing us to change the defualt state of this boolean variable via url, however from initial testing, promoted variables do not work when accessing module via a Carbon workspace (i.e. despite adding the url parameter, it is truncated and upon loading the variable is in its default state). If that is the case, when setting up action notification we cannot point to Carbon workspace.

Is there a way to use promoted variables if we want to open this module in a Carbon workspace? Alternatively, is there a way to achieve different layouts that would change depending on where the module is being accessed from without using promoted variables?


Solution

  • You're very close. Here's how you pass the promoted variable value to the workshop module inside the carbon workspace.

    1. Configure the Carbon workspace using the YAML editor
    2. In the section where you include the module you're referring to, change the YAML from what you have to something that looks like the config below (see the docs for what I referred to example).
    3. In the YAML, pass in your boolean as a string, just like I have below. The name of my promoted variable in this example is isChecked

    In the browser's URL bar you should see this: enter image description here

    Config:

    displayMetadata:
      title: Promoted Var Workspace
      description: null
      enableDarkMode: null
      headerMenuOptions: null
      isAcademyShown: false
      isHelpShown: false
      isDocumentationShown: false
      isNotificationsDropdownShown: true
      isUserProfileShown: true
    versionMetadata:
      description: Initial version
    discoverableModules:
      - ri.workshop.main.module.<the-module-your-question-is-about>
    configuration:
      moduleShortcuts:
        primary: []
        secondary: []
      homePage:
        type: internalHomePage
        internalHomePage:
          logo: null
          welcomeText: null
          welcomeTextWithMarkdown: null
          shouldHideSearchBar: null
          searchBarPlaceholder: null
          defaultObjectTypesFilter: null
          columns:
            - sections:
                - title: Module with promoted var
                  description: null
                  displayAs: null
                  contents:
                    type: custom
                    custom:
                      items:
                        - type: module
                          module:
                            displayMetadata:
                              title: null
                              description: null
                              icon: null
                              thumbnail: null
                            moduleRid: >-
                              ri.workshop.main.module.<the-module-your-question-is-about>
                            parameterValues:
                              variable.isChecked:
                                type: string
                                string:
                                  string: 'true'
            - sections:
                - title: null
                  description: null
                  displayAs: null
                  contents:
                    type: objectTypes
                    objectTypes:
                      objectTypes: null
            - sections:
                - title: null
                  description: null
                  displayAs: null
                  contents:
                    type: savedExplorations
                    savedExplorations: {}
      parameters: []
      parametersDisplayMetadata: null
      enablement:
        navigationOutOfCarbonDisabled: false
        moduleBlockList: []
    targetDeviceTypes: []
    

    And here's what it looks like: gif of opening app from workspace with url param