---
schema_version: "1"
id: f602e7f18774cae25faf18b68b14ea65c6f56de77dcddd5b2492ed399f835b8a
title: Getting Query String Parameters
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/quick-start/pages-quick-start-query-params-getting.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-quick-start-query-params-getting.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3a9b11443a7dff9819639080aa9f36f0d18b22a3db94a01a73be013df8ea4415
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Getting Query String Parameters

You can reference query string parameters in Visualforce markup by using the `$CurrentPage` global variable. Using `$CurrentPage`, you can access the query string parameters for the page by specifying the `parameters` attribute, after which you can access each individual parameter:

```visualforce
$CurrentPage.parameters.parameter_name
```

For example, suppose you want to add detail information about a specific contact to an Account page. The account record ID is specified by the default `id` query string parameter, and the contact record ID is specified by the query string parameter named `cid`:

<!-- otherprops: apex_page set_clipboard -->
```markup
<apex:page standardController="Account">
    <apex:pageBlock title="Hello {!$User.FirstName}!">
        You are displaying values from the {!account.name} account and a separate contact
        that is specified by a query string parameter.
    </apex:pageBlock>
    <apex:pageBlock title="Contacts">
        <apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
              <apex:column>
               <apex:facet name="header">Name</apex:facet>
                {!contact.Name}
              </apex:column>
              <apex:column>
               <apex:facet name="header">Phone</apex:facet>
              {!contact.Phone}
              </apex:column>
        </apex:dataTable>
    </apex:pageBlock>
    <apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false" title="false"/> 
</apex:page>
```

For this example to render properly, you must associate the Visualforce page with valid account and contact IDs in the URL. For example, if `001D000000IRt53` is the account ID and `003D000000Q0bIE` is the contact ID, the resulting URL should be:

```nolang
https://MyDomain_login_URL/apex/MyFirstPage?id=001D000000IRt53&cid=003D000000Q0bIE
```

[Displaying Field Values with Visualforce](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-quick-start-display-field-values.md) has more information about retrieving the ID of a record.

**note:** If you use the `id` parameter in a URL, it must refer to the same entity referred to in the standard controller.

![A Visualforce page that uses query string parameters](../../../../../media/salesforce-pages-developers-guide/pages_quick_start_query_string_params.png "Using Query
String Parameters in a                     Page")

