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.
Variables
Start each script with the prescribed variable.
1
2
var valueToSet = ""; // Data Fields, Forms, Pages, Reports
var ActionEnabled = false; // Workflow
Accessing Most Fields
Accessing 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"}}"
Accessing 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"}}"
Accessing 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"}}