DOCUMENTS 5 - PortalScripting API
Field Access Methods


The DocFile class offers the following ways to access the field values:

It is worth to mention that DocFile.fieldName and DocFile.setFieldValue(fieldName, value) for an active file need DocFile.sync(checkHistoryFields) to synchronize the changes of the DocFile object back to the real file. For an archive file you must call DocFile.startEdit() before setting the field values and afterwards use DocFile.commit() to commit the changes.

The table below gives an overview about data types of the return values and shows how to set field values by means of examples, whereby the following settings are assumed:

Field typeAccess methodsJavaScript type of return
value / input parameter
for field value
Example of return value

Example of setting field value

String, E-Mail,
Text Fixed Font,
Text, URL, HTML
DocFile.fieldNameString"Hello"file.stringField = "Hello";
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
String"Hello"file.setFieldValue("stringField", "Hello");
file.sync();

DocFile.getAutoText()String"Hello"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"Hello"

file.setFieldAttribute("stringField", "Value", "Hello");

Checkbox, BoolDocFile.fieldNameBooleantrue / falsefile.boolField = false;
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
Booleantrue / falsefile.setFieldValue("boolField", false);
file.sync();

DocFile.getAutoText()String"1" / "0"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"1" / "0"

file.setFieldAttribute("boolField", "Value", "0");

DateDocFile.fieldNameDatea Date object / null if emptyfile.dateField = new Date(2013, 6, 22);
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
Datea Date object / null if emptyfile.setFieldValue("dateField", new Date(2013, 6, 22));
file.sync();

DocFile.getAutoText()String"07/22/2013"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"22.07.2013"

file.setFieldAttribute("dateField", "Value", "22.07.2013");

TimestampDocFile.fieldNameDatea Date object / null if emptyfile.tsField = new Date(2013, 6, 22, 13, 30);
file.sync()

DocFile.getFieldValue()
DocFile.setFieldValue()
Datea Date object / null if emptyfile.setFieldValue("tsField", new Date(2013, 6, 22, 13, 30));
file.sync();

DocFile.getAutoText()String"07/22/2013 13:30"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"22.07.2013 13:30"

file.setFieldAttribute("tsField", "Value", "22.07.2013 13:30");

EnumerationDocFile.fieldNameString"No3"
(from the enumeration value:
No3; de:Drei; en:Three)
file.enumField = "No3";
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
String"No3"file.setFieldValue("enumField", "No3");
file.sync();

DocFile.getAutoText()String"Three"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"No3"

file.setFieldAttribute("enumField", "Value", "No3");

NumericDocFile.fieldNameNumber22.33file.numField = 22.33;
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
Number22.33file.setFieldValue("numField", 22.33);
file.sync();

DocFile.getAutoText()String"22.33"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"22,33"

file.setFieldAttribute("numField", "Value", "22,33");

ReferenceDocFile.fieldNameString"schreiber\nSchreiber, Willi"
(see 'Example enumeration value
for reference field' above)
file.refField = "schreiber\nSchreiber, Willi";
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
String"schreiber\nSchreiber, Willi" file.setFieldValue("refField", "schreiber\nSchreiber, Willi");
file.sync();

DocFile.getAutoText()String"Schreiber, Willi"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"schreiber\nSchreiber, Willi"

file.setFieldAttribute("refField", "Value", "schreiber\nSchreiber, Willi");

HistoryDocFile.fieldNameString"23.07.2013 13:03 schreiber: Received"file.historyField = "Received";
file.sync(true);

DocFile.getFieldValue()
DocFile.setFieldValue()
String"23.07.2013 13:03 schreiber: Received"file.setFieldValue("historyField", "Received");
file.sync(true);

DocFile.getAutoText()String"23.07.2013 13:03 schreiber: Received"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"23.07.2013 13:03 schreiber: Received"

file.setFieldAttribute("historyField", "Value", "Received");

Double select listDocFile.fieldNameString"No2\r\nNo3"
(from the enumeration values:
No2; de:Zwei; en:Two
No3; de:Drei; en:Three)
file.dsListField = "No2\r\nNo3";
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
String"No2\r\nNo3"
// or (Array as returnType)
["No2", "No3"]
file.setFieldValue("dsListField", "No2\r\nNo3");
// or (value passed as an Array)
file.setFieldValue("dsListField", ["No2", "No3"]);
file.sync();

DocFile.getAutoText()String"Two\r\nThree"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"No2\r\nNo3"

file.setFieldAttribute("dsListField", "Value", "No2\r\nNo3");

Filing planDocFile.fieldNameString"II.01"file.fpField = "II.01";
file.sync();

DocFile.getFieldValue()
DocFile.setFieldValue()
String"II.01"file.setFieldValue("fpField", "II.01");
file.sync();

DocFile.getAutoText()String"II.01"

DocFile.getFieldAttribute()
DocFile.setFieldAttribute()
String"002001"file.setFieldAttribute("fpField", "Value", "002001");



This documentation refers DOCUMENTS 5.0e (2105).
Created at 11-09-2019. - © 1998-2019 otris software AG, Königswall 21, D-44137 Dortmund. support@otris.de