Skip Navigation
Expand
Including a variable on a custom tab, custom link, or browser control URL
Answer ID 2429   |   Last Review Date 01/15/2020

When defining a URL for a browser control, custom link or custom tab, how can I include a variable so that users see information that is relevant to their incident, contact, or organization?

Environment:

August 2012 and newer

Resolution:

When adding a browser control to a workspace or script, you can pass variables as URL parameters to prepopulate field values in the resulting page. You can also include variables when adding custom links to the Links menu.  

When passed through a parameterized URL, each variable is replaced with the field value from the record (or associated record) that is currently being edited. Variables can be used to pass ID values for certain record types including incidents, answers, contacts, organizations, and staff accounts. They can also pass values from database fields, custom fields, or custom object fields.  

To pass variables to a target page, build the URL using the standard query-string syntax, as follows:

http://server/path?<parameter_1>=<variable>[&<parameter_2>=<variable>[&…]]

The following sections provide descriptions and examples of variables that can be passed from records in Oracle Service Cloud through parameterized URLs.

Note:  This function is supported for menu, integer, text field, date, date-time, and yes/no field types. To successfully pass variables through a parameterized URL, the target page must be designed to process and/or display the variables you include. You can use PHP or another HTML-embedded scripting language to perform the task of populating the fields.  


Passing Record IDs

The following variables can be used to pass the ID value of the current record.

  • $p_acct_id     Passes the account ID of the user currently logged in.
  • $p_c_id     Passes the contact ID of the contact you are currently editing or the contact associated with the incident you are currently editing.
  • $p_org_id     Passes the organization ID of the organization you are currently editing.
  • $p_refno     Passes the reference number of the incident you are currently editing.
  • $p_a_id     Passes the answer ID of the answer you are currently editing.
  • $p_m_id     Passes the meta-answer ID of the meta-answer or answer you are currently editing.
  • $opportunity.op_id     Passes the opportunity ID of the opportunity being edited
  • $p_sid          Passes the session id of the account


Example:  The following URL passes the value of the current record's contact ID to a field named contact id.

http://www.mydomain.com/myform.php?customer_id=$p_c_id



Passing Database Field Values

The following variables can be used to pass database field values associated with the current record. Database field names and functions are described by the Data Dictionary (Configuration>Database>Data Dictionary).  Except where indicated, database field values can be passed in Oracle Service Cloud versions 8.0 and higher.  

$contact.<field_name>       Passes contact field values.
$org.<field_name>      Passes organization field values
$incident.<field_name>      Passes incident field values
$opportunity.<field_name>      Passes opportunity field values
$p_sid      Passes the session ID  value

Example:  In some cases, you can also specify an object within a field.  The following URL passes the street portion of the contact address field to a field named street_addr.

http://www.mydomain.com/myform.php?street_addr=$contact.street.addr

For more information on this refer to the 'Passing variables in URL in Browser Control in Custom Workspaces' Community post.



Passing Custom Field Values

August 2012 and newer releases

You can pass information in the URL Query string using standard query string syntax of the form:

<base_URL>?<param_name>=<param_value>&<param_name>=<param_value>

You can specify Oracle data in a URL <param_value> as follows:

  • Contact attributes as $contact.<fieldname>
  • Organization attributes as $org.<fieldname>
  • Incident attributes as $incident.<fieldname>
  • Answer attributes as $answer.<fieldname> (Note: only customer fields and system attributes are supported for answers. Standard fields are not supported.)
  • Opportunity attributes as $opportunity.<fieldname>
  • Session ID (account session id) as $p_sid

You can specify customer fields by name in the URL by replacing <param_name> with the name of the custom field you wish to use. For instance, $object_name.c$field_name.

For example, you could pass an incident custom field in a URL as follows:

http://server/testpage.php?p_1=$incident.c$text1

For further information, refer to the online documentation for URL Parameters.


Passing Custom Object Field Values

The following variable can be used to pass the value of a custom object field based on the package name, object name, and field name.

$package_name$object_name.field_name

To find the package name, object name, and field name to use in a custom object field variable, open the Data Dictionary (Configuration>Database>Data Dictionary). Custom object tables are listed in the format package_name$object_name.  For example, if a custom object named WorkOrder resides in the CO package, it will be listed in the Data Dictionary as CO$WorkOrder.  You can click the table to see a list of columns (fields) that can be passed in variables. For a column containing menu items, click the column to see the list of items along with the values that represent them.

Example:  The following URL passes information about a field named PaymentType in an object named WorkOrder in the CO package to a field named payment_type.

http://www.mydomain.com/myform.php?payment_type=$CO$WorkOrder.PaymentType

System/Custom Attribute on the Incident object:  System attributes can be passed using this syntax: $object_name.package_name$field_name, e.g. $incident.CO$FieldText

Passing variables to custom tabs in the Mailing Editor


You can also pass variables to custom tabs created in the Mailing Editor using the MAILING_EDITOR_TABS configuration setting (found under Rightnow User Interface > Miscellaneous).  Any field from the mailings table may be passed as a parameter in URLs defined by this setting.  

Example:  The following URL uses a merge field to pass the mailing id to a custom page.

(tab("Revenue",http://www.mydomain.com/revenue/report.php?mailing=$mailing.mailing_id))
See the setting's description in the configuration editor for more information about its use.


For additional information, refer to the 'Workspace and Script Elements' section in online documentation for the version your site is currently running. To access Oracle Service Cloud manuals and documentation online, refer to the Documentation for Oracle Service Cloud Products.

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.