To set any value either related to the record or to the exit conditions of the script action, the ALset function will be used. The examples here assume that “out” has been defined in the main function as follows:
out = ALset(outputXMLFile)
The specific examples will call functions of “out” to set values.
The main types of values that can be set in the output file are:
- A standard field in the current record.
- Attached files: adding, removing, and replacing
- A message to be displayed to the user.
- A url to redirect the user to.
- The exit action – this determines if the record is saved or rolled back and if they are redirected.
- Saving the file once the changes are complete.
Note that unlike ALget, only values in the current record can be set. Values cannot be set in other records in the system.
Here are examples of referencing each of these types of values with comments. In each example we are assigning the output value from a new variable.
#Set the ‘priority’ field based on the variable Value1
#Add the file "sample.txt" located at C:\tmp to the file "attached_files".
#The general format is ALset.addFile(fieldName, fileName, filePath). The absolute path must be used.
ALset.addFile('attached_files', 'sample.txt', 'C:\tmp\')
#Remove the file "old.txt" from the "attached_files" field
#Replace the file "old.txt" in the "attached_files" field with the file "new.txt" located at C:\tmp. Note that this is only used with file versioning.
replaceFile('attached_files', 'old.txt', 'new.txt', 'C:\tmp\')
#Set the user message based on the variable Value2
#Set a redirect url based on the variable Value3
#Set the exit action. The only accepted actions are the 4 shown.
#Save the output file. This is necessary to make sure the changes are actually conveyed back to the system.