---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Presentation Components, UI components]
nav: wcp_docs
parent_url: /wcp_docs/
title: >- 
  Reference: Predefined App Variables
layout: subsection
---

<a id="section_N10021_N1001E_N10001"></a>
Presentation Components provide predefined variables containing useful runtime information for your app. Use these app variables as script or expression variables in your app components. Example: `<% appVariableName %>`.

<b>Note:</b> The predefined app variables aren't available in script modules. Predefined variables are reserved keywords that you can't use within a script module. However, PMDs can pass predefined variables as input parameters to a script of a script module. If a PMD passes a predefined variable to a script, its function declaration within the script module must use a different input parameter name.

## <a id="section_o4r_gvv_32b"></a>App Variables

## <a id="section_1"></a>apiGatewayEndpoint

Returns the API Gateway endpoint as a string.

Example: This sample AMD uses the `apiGatewayEndpoint` variable:

```
"dataProviders" : [
  {
    "key": "WORKDAY-WQL",
    "value": "<% apiGatewayEndpoint + '/wql/v1/' %>"
  }
],
...
```

`apiGatewayEndpoint` returns the value `https://api.workday.com`.

## <a id="section_N10167_N10145_N10001"></a>attrstore

Contains the app-level attributes defined on the Console on the Extend Developer Site. Use App Manager to configure tenant-specific attribute values. An app attribute automatically resolves its value based on the environment the app is running in.

Example: This sample `text` tag assumes that you've created <i>myAppAttribute</i> on the Console and that you've assigned a value in App Manager:

```
{
 "type": "text",
 "label": "myAppAttribute value",
 "value": "<% attrstore.myAppAttribute %>"
}
```

See [Concept: App Attributes](/wcp_docs/ssm1634848394616.html).

## <a id="section_N101B3_N10145_N10001"></a>endpoints

A list of inbound endpoint references defined on the page. Use `<% endpoints.endPointName %>` to reference a specific endpoint.

The `searchEndPoint` attribute of this sample `instanceList` references a sample endpoint named `workerSearch`:

```
{
 "type": "instanceList",
 "searchEndPoint": "<% endpoints.workerSearch %>",
 "multiSelect": "false",
 "id": "instanceListWorkerSearch",
 "label": "Relationship Manager",
 "searchResultValues": "<% workerSearch.data %>",
 "required": "<% true %>",
 "values": "<% [worker] %>",
 "selectedValues": "<% [worker] %>",
 "valueOutBinding": "charity.relationshipManager.id"
}
```

## <a id="section_N101D9_N10145_N10001"></a>environment

The Workday-defined value for the runtime tenant environment.

Possible values:

-   IMPL - Sandbox, Implementation, System Verification Test (SVT) environments.
-   PROD - Production environment.
-   SANDBOX - Customer Sandbox and Customer Sandbox Preview environments.
-   WCPDEV - Development environment.


Example:

```
{
   "type": "text",
   "label": "Current Environment",
   "value": "<% environment %>"
}
```

## <a id="section_N10207_N10145_N10001"></a>errorCode

String of the error code returned when rendering a custom error page.

## <a id="section_N10214_N10145_N10001"></a>errorMessage

String of the error message returned when rendering a custom error page.

## <a id="section_N10221_N10145_N10001"></a>flowVariables

A map of variables that exist through the lifecycle of a flow. You can define a flow variable using an outboundVariable with `"variableScope": "flow"`.

This PMD snippet defines an `outboundVariable` for an `outboundEndpoint`:

```
 "outboundData": {
   "outboundEndPoints": [
     {
       "type": "outboundDataURI",
       "name": "outboundDataURIExample",
       "baseUrlType": "TEST",
       "url": "/test"
     },
     {
       "type": "outboundVariable",
       "name": "outboundFlowVariableExample",
       "variableScope": "flow",
       "values": [
         {
           "outboundPath": "aFlowVariable",
           "value": "<% aTextField.value %>"
         }
       ]
     }
   ]
 }
```

This PMD snippet uses `flowVariables.aFlowVariable`:

```
{
 "type": "text",
 "id": "aTextField",
 "label": "Submit this value",
 "value": "<% flowVariables.aFlowVariable %>"
)
```

<b>Note:</b>

-   When you reference a property in `flowVariables`, ensure that the property already exists before you reference it. To check the empty state of a `flowVariables` property, you can use either the ternary operator `?:` or the null-coalescing operator `??`. Example: `"value": "<% flowVariables.aFlowVariable ?: 'falseValue' %>"`
-   The values in `flowVariables` can't be `null`.
-   For outbound variables (both flow and session variables), the `values` attribute and `onSend` event are mutually exclusive. If you specify both, the `values` attribute takes precedence.



## <a id="section_N1027D_N10145_N10001"></a>instanceListQuery

A string containing the value entered by a user on an `instanceList` tag that uses the `searchEndPoint` attribute. You can use `instanceListQuery` in the endPoint url for a search query, which becomes automatically URL-encoded.

This sample endpoint uses `instanceListQuery` in the `url`:

```
{
 "name": "workerSearch",
 "baseUrlType": "workday-staffing",
 "url": "<% 'workers?search=' + instanceListQuery %>",
 "exclude": "<% empty(instanceListQuery) %>",
 "authType": "sso",
 "deferred": "true"
}
```

This sample `instanceList` tag uses the `searchEndPoint` attribute:

```
{
 "type": "instanceList",
 "searchEndPoint": "<% endpoints.workerSearch %>",
 "multiSelect": "false",
 "id": "instanceListWorkerSearch",
 "label": "Relationship Manager",
 "searchResultValues": "<% workerSearch.data %>",
 "required": "<% true %>",
 "values": "<% (!(empty(charity.relationshipManager))) ? [charity.relationshipManager] : [] %>",
 "selectedValues": "<% (!(empty(charity.relationshipManager))) ? [charity.relationshipManager] : [] %>",
 "valueOutBinding": "updateCharity.relationshipManager.id"
}
```

<b>Note:</b> Instead of using `searchEndPoint`, `searchResultValues`, and `instanceListQuery`, you can use the `onSearch` event of the `instanceList`. The `onSearch`event provides the `event.query` property, which contains the input search string. See the <i>Populating a List with the onSearch Event</i> section in [Concept: instanceList](/wcp_docs/GUID-17f49183-14bb-4cd3-95a1-1e3dd8ded432-enHYPHENus.html).

## <a id="section_N102B7_N10145_N10001"></a>languageCode

The language code of the current user. Presentation Components evaluate the language code from the user session for metadata sites, and from the URL for external sites.

## <a id="section_N102C4_N10145_N10001"></a>pageVariables

For PMD Scripting only: A map of custom variables that exist during the lifecycle of the page.

Use `pageVariables` on both view and edit pages. `pageVariables` enable you to:

-   Store values and reference those values on the same PMD. Example: If you set `<% pageVariables.foo = 'abc'; %>`, you can reference or update `pageVariables.foo` anywhere on the page.
-   Reuse the result of a function multiple times in the page.
-   Use the variables during the page lifecycle. You can use the variables from page load with inbound endpoints, event handling, and to page submission of an edit page.


## <a id="section_N102F5_N10145_N10001"></a>pagingVariables

A map of the `limit` and `offset` variables used with endpoint pagination.

Each time a paging request triggers, the request automatically updates the `pagingVariables.limit` and `pagingVariables.offset` values for the grid. Each grid maintains separate `pagingVariables` from other grids.

The `pagingVariables.limit` and `pagingVariables.offset` are string variables. You can include `pagingVariables` in an inbound endpoint URL when using the `pagingInfo` attribute of the `grid` tag. To set their initial values, you can use the ternary operator to check their empty state and assign the value. Example:

```
"endPoints": [
   {
     "baseUrlType": "workday-staffing",
     "name": "workersPagedEndpoint",
     "authType": "sso",
     "url": "<%
       var limit = pagingVariables.limit ?: 100;
       var offset = pagingVariables.offset ?: 0;
       '/workers?limit=' + limit + '&offset=' + offset;
     %>"
   }
]
```

## <a id="section_N10326_N10145_N10001"></a>pmdSessionVariables

A map of variables that are valid throughout the current user session. The session variables expire when the user session ends or has no activity for 2 hours.

You can set `pmdSessionVariables` using the `outboundVariable` tag with `"variableScope": "session"`.

This PMD snippet includes a session `outboundVariable`:

```
"outboundData": {
   "outboundEndPoints": [
     {
       "name": "sampleOutboundEndpoint",
       "baseUrlType": "sampleBaseUrl",
       "url": "/posts/1",
       "authType": "NOAUTH"
     },
     {
       "type": "outboundVariable",
       "name": "sampleOutboundVariable",
       "variableScope": "session",
       "values": [
         {
           "outboundPath": "userTextValue",
           "value": "<% aTextWidget.value %>"
         }
       ]
     }
   ]
 }
```

This sample `text` tag from another PMD references the `userTextValue` session variable from the preceding PMD:

```
{
  "type": "text",
  "label": "Saved session variable",
  "value": "<% pmdSessionVariables.userTextValue %>"
}
```

<b>Note:</b>

-   Use session variables with caution and at a minimum. Session variables can potentially affect performance and resource usage.
-   The values in `pmdSessionVariables` can't be `null`.
-   For outbound variables (both flow and session variables), the `values` attribute and `onSend` event are mutually exclusive. If you specify both, the `values` attribute takes precedence.



## <a id="section_N1037D_N10145_N10001"></a>queryParams

A map of query parameters, which are the name=value pairs after the `?` in the app URL that loads the page. You can specify query parameters in:

-   Parameter bindings of a `taskReference`.

    This sample `button` defines the `workerID` parameter binding when it calls the `reviewDetails` page.

    ```
    {
     "type": "button",
     "taskReference": {
       "taskId": "reviewDetails",
       "parameterBindings": {
         "workerID": "<% currentWorker.id %>"
       }
     },
     "action": "LINK",
     "label": "Review Details"
    }
    ```

    The parameter binding from the `taskReference` of the button becomes a query parameter. When a user clicks the button, the query parameter displays in the app URL. Example:

    ```
    ../reviewDetails?workerID=12345
    ```

    Note the `routingPattern` in the task definition of `reviewDetails`. The URL appends query parameters to the `routingPattern`.

    ```
    {  
     "id": "reviewDetails",  
     "routingPattern": "/reviewDetails",  
     "page": {    
       "id": "reviewDetails"  
     }
    }
    ```

    This sample `hidden` tag references the `queryParams.workerID` variable:

    ```
    {
     "type": "hidden",
     "id": "saveWorkderID",
     "value": "<% queryParams.workerID %>"
    }
    ```

-   Query parameters in the route path of a custom task. Example: `/reviewDetails?workerID={customTaskObjectId}&title={taskTitle}`.

    To reference the `workerID` query parameter, use `<% queryParams.workerID %>`. Note that `{customTaskObjectId}` is a keyword that contains the ID of the context instance, which is available when a Related Actions menu item runs the custom task in Workday. The `title` query parameter uses the `{taskTitle}` keyword, which contains the custom task title.

    <b>Note:</b>

    -   The query parameters on a page that starts a page flow don't persist after a user navigates back to it from a page flow. To persist the parameters on the landing page, use path parameters and the `routeParams` variable instead.
    -   When you reference a property in `queryParams`, ensure that the property already exists before you reference it. To check the empty state of a `queryParams` property, you can use either the ternary operator `?:` or the null-coalescing operator `??`. Example: `"value": "<% queryParams.someVariable ?: 'falseValue' %>"`
    -   Don't use the reserved keyword "type" as a query parameter.



## <a id="section_N10423_N10145_N10001"></a>routeParams

A map of path parameters, which are the path segments within the app URL that loads the page. When a custom task loads the page, the `routeParams` map contains the path parameters in the route path of the custom task.

This sample route path of a custom task uses `{customTaskObjectId}` and `{taskTitle}` as path parameters.

```
/reviewDetails/{customTaskObjectId}/{taskTitle}
```

<b>Note:</b>

-   `{customTaskObjectId}` is a keyword that contains the ID of the context instance, which is available when a Related Actions menu item runs the custom task in Workday. The `{taskTitle}` path parameter is a keyword that contains the custom task title.
-   Don't use the reserved keyword `{type}` as a path parameter.


The sample task definition in `tasks[]` in the AMD:

```
{  
 "id": "reviewDetails",  
 "routingPattern": "/reviewDetails/{workerID}/{title}",  
 "page": {    
   "id": "reviewDetails"  
 }
}
```

This sample `button` navigates to the `reviewDetails` page. The parameter bindings of the `taskReference` must match the path parameters in the `routingPattern` of the task definition in the AMD.

```
{
 "type": "button",
 "taskReference": {
   "taskId": "reviewDetails",
   "parameterBindings": {
     "workerID": "<% currentWorker.id %>",
     "title": "Review Details"
   }
 },
 "action": "PRIMARY",
 "label": "Next Task"
}
```

When a user clicks the button, the path parameter value displays in the app URL. Example:

```
../reviewDetails/12345/Review%20Details
```

This sample `text` tag uses the `routeParams.title` variable:

```
{
 "type": "text",
 "id": "taskTitle",
 "value": "<% routeParams.title %>"
}
```

## <a id="section_N10498_N10145_N10001"></a>self

Use this variable to reference a widget to itself. So instead of using the `id` of the tag, use `<% self %>`.

## <a id="section_N104AD_N10145_N10001"></a>service_environment

The Workday-defined value for the data center tenant environment. On a development tenant, the value is `suv`.

## <a id="section_N104BE_N10145_N10001"></a>site

References the `site` object that contains attributes of the app, site, and domain information. To use a `site` attribute, specify `<% site.attributeName %>`. Example: `<% site.applicationId %>`.

`site` attributes:

-   [site.applicationId](/wcp_docs/urd1528494500512.html#section-siteapplicationid)
-   [site.appProperties](/wcp_docs/urd1528494500512.html#section-siteappproperties)
-   [site.languages](/wcp_docs/urd1528494500512.html#section-sitelanguages)
-   [site.siteId](/wcp_docs/urd1528494500512.html#section-sitesiteid)
-   [site.tenantId](/wcp_docs/urd1528494500512.html#section-sitetenantid)
-   [site.title](/wcp_docs/urd1528494500512.html#section-sitetitle)


## <a id="section-siteapplicationid"></a>site.applicationId

A string containing the `applicationId` attribute of the AMD.

## <a id="section-siteappproperties"></a>site.appProperties

Contains custom property values defined in `appProperties` in the AMD. To reference an app property in your PMD, specify `<% site.appProperties.appPropertyKey %>`. Example:

```
"title": {
  "type": "title",
  "label": "<% site.appProperties.appName %>"
}
```

## <a id="section-sitelanguages"></a>site.languages

A list corresponding to the languages attribute of the SMD.

## <a id="section-sitesiteid"></a>site.siteId

A string containing the siteId attribute of the SMD.

## <a id="section-sitetenantid"></a>site.tenantId

A string containing the name of the Workday tenant used with the site.

## <a id="section-sitetitle"></a>site.title

A title in the `titles` array in the SMD, according to the appropriate language of the site.

## <a id="section-tenant"></a>tenant

The name of the Workday tenant. Example: `gms`

## <a id="section-usertimezone"></a>userTimeZone

A string containing the preferred timezone of the currently logged-in Workday user. If the preferred timezone is not set for the Workday user, the userTimeZone contains the user's default timezone. Example:

```
{
 "type": "date",
 "datePrecision": "SECOND",
 "label": "Current date and time in my timezone:",
 "value": "<% date:getTodaysDate(date:getDateTimeZone(userTimeZone)) %>"
}
```

### Related Information

[Reference: Extend App Metadata](/wcp_docs/btj1547749859781.html)

[Reference: PMD Tags](/wcp_docs/dyg1528862158582.html)

[Reference: Site Metadata](/wcp_docs/mwr1528410641805.html)

