Returns the value of a named context variable.
Context variables are available server-side and contain information supplied by the forms service and site framework about the current article, user, or subsite.
Executed
Server-side only.
Arguments
Argument | Name | Return Type | Description |
---|---|---|---|
variableName | ARTICLEEXTRAS | Object | The "extras" of the current article |
ARTICLEID | Integer | The ID of the current article | |
BASEHREF | String | The site's base href | |
CANONICALURL | String | The page's canonical URL | |
FORMSESSIONID | String | The current form session ID | |
FRIENDLYURL | String | The page's friendly URL | |
ICMURL | String | The iCM URL (as set in autoconfig ie the "enterprise" URL) | |
ISLOGGEDIN | Boolean | Whether the current user is logged in | |
PAGEURL | String | The page URL | |
PROCESSBUSINESSKEY | String | The process business key if this is a form used during a workflow instance (ie a task form) | |
PROXYUSERID | String | The proxy user ID (if used via assisted service) | |
PROXYUSERNAME | String | The proxy user name | |
RELATEDMETADATA | Array of objects, each representing a related metadata value{ | Metadata related to the current article | |
REQUESTURL | String | The full request URL including parameters | |
SESSIONID | String | The current session ID | |
SITEUSERGROUPMEMBERSHIPS | String (comma separated list of group IDs) | The user groups of the current user | |
SITEUSERID | Integer | The ID of the current user. If running in iCM this will be the iCM user's first site user alias | |
SITEUSERNAME | String | The username of the current user. If running in iCM this will be the iCM user's first site user alias | |
SITEUSERALIASES | Array of objects, each with a username and userid[{ | Only available to forms running inside iCM. The site user aliases of the current iCM user | |
SUBSITEID | Integer | The ID of the subsite the form is displayed on | |
SUBSITENAME | String | The name of the subsite the form is displayed on | |
TASKID | Integer | The ID of the task if this form is being displayed as part of a process instance task | |
THEMENAME | String | The name of the theme the subsite is using |
Returns
The value of the variable.
Using an example form on this site, typical values would be:
{
"ArticleExtras": {
"MYACCOUNTRENDERREADONLY": "No",
"ENGLISHARTICLEID": ""
},
"ArticleID": 1234,
"BaseHREF": "https://docs.gossinteractive.com/",
"CanonicalURL": "https://docs.gossinteractive.com/article/1234/Test-form",
"FormSessionID": "206f84a8-222d-4c3f-ac48-f9c696969db3",
"FriendlyURL": "https://docs.gossinteractive.com/testform",
"iCMURL": "https://docs.gossinteractive.com/enterprise/icm",
"IsLoggedIn": true,
"PageURL": "https://docs.gossinteractive.com/article/1234/Test-form",
"RelatedMetadata": [{
"PropertyName": "Alphabetic Metadata Relations",
"Description": "MetaData starting with F",
"Value": "F",
"Id": 3249,
"PropertyId": 322
}, {
"PropertyName": "Colours",
"Description": "",
"Value": "Red",
"Id": 13328,
"PropertyId": 1705
}],
"RequestURL": "https://docs.gossinteractive.com/1234",
"SessionID": "8fc9fee7-72e5-44f4-82e2-9304149d55f5",
"SiteUserGroupMemberships": "4,9",
"SiteUserID": 123,
"SiteUserName": "TESTUSER",
"SubsiteID": 1,
"SubsiteName": "GOSSDocs",
"ThemeName": "chill"
}
Example
function (helper, defaultValue, currentValue) {
var theValue = helper.getSiteVariable("ARTICLEID");
return theValue;
}