Fullscreen Image

Syntax - JavaScript in Lucernex

The grammar or syntax of a programming language dictates meaning through the order of words and commands. Just like we have verbs and nouns in language, we have objects and actions in programming languages.

ClosedVariables

Start each script with the prescribed variable.

Copy
var valueToSet = "";       // Data Fields, Forms, Pages, Reports
var ActionEnabled = false; // Workflow

ClosedAccessing Most Fields

  • Syntax

    Copy
    "${LxScriptName}"
  • Examples

    The following example shows the name of the location associated with the current facility.

    Copy
    "${Facility.LocationID}"

    The following example shows the name of the project type associated with the current entity.

    Copy
    "${ProjectEntity.CodeProjectTypeID}"

ClosedAccessing Schedule Task Fields

  • Syntax

    Copy
    "${Task.LxIntegrationName:{TaskName:"Field Context"}}"
    Note:
    • Use “Task.”, not “TaskItem.”, despite what’s shown for the Lucernex script name.

    • Use double quotes within double quotes. Do not confuse this syntax with string literal syntax.

  • Examples

    The following example shows the Forecast / Actual End Date of the Store Open task for the current entity.

    Copy
    "${Task.ActualEndDate:{TaskName:"Store Open"}}"

    The following example shows the status of the Construction Start task for the current entity.

    Copy
    "${Task.CodeTaskStatusID:{TaskName:"Construction Start"}}"

ClosedAccessing Member Fields

  • Syntax

    Copy
    "${LxScriptNameForMemberIDField:{"ShowForeignVal":"true","sForeignVal_RGAF_ID_LookupKey":"LxIntegrationNameForMemberField"}}"
  • Examples

    The following example shows the name of the employer associated with the ad hoc work flow assignee.

    Copy
    "${WorkFlow.AdhocMemberID:{"ShowForeignVal":"true","sForeignVal_RGAF_ID_LookupKey":"EmployerID"}}"

    The following example shows the email of the member who created the form.

    Copy
    "${Issue.InitiatedByMemberID:{"ShowForeignVal":"true","sForeignVal_RGAF_ID_LookupKey":"EMail1"}}"

ClosedAccessing Field Descriptions

  • Syntax

    Copy
    "${LxScriptName:{"FieldContextVal":"ShowCodeDescription"}}"
    Note:

    This syntax only works for global drop-down lists, not client-defined drop-down lists.

  • Examples

    The following example shows the description of the selected value for the Project Type drop-down list.

    Copy
    "${ProjectEntity.CodeProjectTypeID:{"FieldContextVal":"ShowCodeDescription"}}"

    The following example shows the description of the selected value for a form-based user-defined drop-down list.

    Copy
    ${Issue.PayType:{"FieldContextVal":"ShowCodeDescription"}}