Toggle menu

helper.getSiteVariable(variableName)

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

ArgumentNameReturn TypeDescription
variableNameARTICLEEXTRASObjectThe "extras" of the current article
 ARTICLEIDIntegerThe ID of the current article
 BASEHREFStringThe site's base href
 CANONICALURLStringThe page's canonical URL
 FORMSESSIONIDStringThe current form session ID
 FRIENDLYURLStringThe page's friendly URL
 ICMURLStringThe iCM URL (as set in autoconfig ie the "enterprise" URL)
 ISLOGGEDINBooleanWhether the current user is logged in
 PAGEURLStringThe page URL
 PROCESSBUSINESSKEYStringThe process business key if this is a form used during a workflow instance (ie a task form)
 PROXYUSERIDStringThe proxy user ID (if used via assisted service)
 PROXYUSERNAMEStringThe proxy user name
 RELATEDMETADATAArray of objects, each representing a related metadata value
{
    "Id": 1,
    "Description": "MetaData starting with A",
    "Value": "A",
    "PropertyId": 1,
    "PropertyName": "Alphabetic Metadata Relations"
}
Metadata related to the current article
 REQUESTURLStringThe full request URL including parameters
 SESSIONIDStringThe current session ID
 SITEUSERGROUPMEMBERSHIPSString (comma separated list of group IDs)The user groups of the current user
 SITEUSERIDIntegerThe ID of the current user. If running in iCM this will be the iCM user's first site user alias
 SITEUSERNAMEStringThe username of the current user. If running in iCM this will be the iCM user's first site user alias
 SITEUSERALIASESArray of objects, each with a username and userid
[{
    "USERID": 14318,
    "USERNAME": "A5304AC8-6DA7-40B3-A7D3-DFA6F964020B"
}, {
    "USERID": 14896,
    "USERNAME": "TIM"
}]
Only available to forms running inside iCM. The site user aliases of the current iCM user
 SUBSITEIDIntegerThe ID of the subsite the form is displayed on
 SUBSITENAMEStringThe name of the subsite the form is displayed on
 TASKIDIntegerThe ID of the task if this form is being displayed as part of a process instance task
 THEMENAMEStringThe 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;
}

Last modified on February 19, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon