Page tree
Skip to end of metadata
Go to start of metadata

ALget Common Use

To retrieve any value related to the record or user, the ALget function will be used. The examples here assume that “input” has been defined in the main function as follows:

input = ALget(inputXMLFile)

The specific examples will call functions of “input” to retrieve values.

The main types of values that can be retrieved from the input file are:

  • A standard field in the current record
  • Attached files from the current record
  • A field related to the user or other global variable
  • A field from a linked record
  • A multiple linked field in the current record
  • A field linked to multiple tables
  • A historical value of a field

Here are examples of referencing each of these types of values with comments. In each example we are assigning the retrieved value to a new variable.

# Get the value in the ‘type_of_problem’ field. This uses the name of the field, not the label.
	Value1 = input.value('type_of_problem')

# Get information about attached files. The files are retrieved as a list of objects with attributes for name and path.
# These are the only attributes available.
	Value2 = input.attachedFiles(‘attached_files’)
	Name1 = Value2[0].name
	Path1 = Value2[0].path

# Get the name of the user who triggered the script.
	Value3 = input.globalVariable('my_full_name')

# Get the phone number from the record linked to by ‘submitter_name’.
# This allows for the possibility of multiple records existing in the link so the index of the desired record must always be indicated. 
# Here we are using index 0 to indicate the first record.
# This cannot follow a chain of links. Only values from records directly linked to the source record are available.
# This is available for any type of linked field set but not related tables or embedded search results.
	Value4 = input.linkedValue(‘submitter_name’, 0, ‘direct_phone’)

# Get information about the affected departments which is a link to a single field with multiple value enabled.
# This creates an object with built in functions for checking contained values and finding records containing a particular value.
#valueMultipleLF is available for all types of linked field sets when multiple records are allowed but not related tables or embedded search results.
	Value5 = input.valueMultipleLF(‘affected_departments)
	if Value5.containsValue("Finance")…
		NextID = Value5.findByValue("Finance")

# Retrieve information about the ‘assignee’ field, which is a link to both the “teams” and “contacts” tables. This creates a list of objects.
# Then check if the ‘assignee’ field has a team selected instead of a contact.
	Value6 = input.linkedRecordsNamesList("assigned_team")
	if input.tableNameForRecord(Value6[0]) == "teams":…

# Get the previous value of the ‘priority’ field. Here we use the optional second parameter for the value function to indicate we want the value
# not from the current record but from the old version of the same record.
	Value7 = input.value(‘priority’, input.oldRecordNamesList()[0])

CONTENTS