DocFileHelper
Constructors
Constructor
new DocFileHelper():
DocFileHelper
Returns
DocFileHelper
Properties
FieldAccess
staticFieldAccess:FieldAccessOptions
Methods
enumvalIterator()
staticenumvalIterator(callback):void
Iterates through the global enumval variable.
Parameters
callback
(options) => void
For each entry the callback is triggered
Returns
void
updateEnumvalEntry()
staticupdateEnumvalEntry(oldValue,newValue):boolean
Parameters
oldValue
string
newValue
string
Returns
boolean
setFieldAccess()
staticsetFieldAccess(fieldName,access):boolean
Helper function to use in "decreaseFieldRightOnFileViewScript" scripts
// ou.cust.filetype.property.dFROnFileViewScript
DocFileHelper.setFieldAccess("field1", "hidden");
DocFileHelper.setFieldAccess("field2", "visible");
DocFileHelper.setFieldAccess("field3", "readOnly");
DocFileHelper.setFieldAccess("field4", "writable");
Parameters
fieldName
string
Name of the field to change access
access
keyof FieldAccessOptions
Access type to set
Returns
boolean
setFieldsAccess()
staticsetFieldsAccess(callback):void
Helper function to use in "decreaseFieldRightOnFileViewScript" scripts
// ou.cust.filetype.property.dFROnFileViewScript
DocFileHelper.setFieldsAccess((options, access) => {
return access.hidden;
});
Parameters
callback
(options, access) => "-rw" | "+rw" | "-w" | "+w"
Callback containing field information
Returns
void
setRegisterVisibility()
staticsetRegisterVisibility(registerName,visible):boolean
Helper function to use in "hideRegisterOnFileViewScript" scripts
// ou.cust.filetype.property.hROnFileViewScript
DocFileHelper.setRegisterVisibility("myRegister", false);
Parameters
registerName
string
Name of the register to change visibility
visible
boolean
Visibility to set
Returns
boolean
setRegistersVisibility()
staticsetRegistersVisibility(callback):void
Helper function to use in "hideRegisterOnFileViewScript" scripts
// ou.cust.filetype.property.hROnFileViewScript
DocFileHelper.setRegistersVisibility((options) => {
// hide register
return false;
// show register
return true;
// or
return;
});
Parameters
callback
(options) => boolean
Callback containing register information
Returns
void
setButtonVisibility()
staticsetButtonVisibility(buttonName,visible):boolean
Helper function to use in "approvedButtons" scripts
// ou.cust.filetype.action.approvedButtons
DocFileHelper.setButtonVisibility("button1", false);
Parameters
buttonName
string
Name of the button to change visibility
visible
boolean
Visibility to set
Returns
boolean
setButtonsVisibility()
staticsetButtonsVisibility(callback):void
Helper function to use in "approvedButtons" scripts
// ou.cust.filetype.action.approvedButtons
DocFileHelper.setButtonsVisibility((options) => {
// hide button
return false;
// show button
return true;
// or
return;
});
Parameters
callback
(options) => boolean
Callback containing button information
Returns
void
validateMandatoryFields()
staticvalidateMandatoryFields(docFile,fields):object
Function to validate that a given list of fields is filled on a docFile
const result = DocFileHelper.validateMandatoryFields(docFile, ["recipient", "vatCode"]);
if (!result.isValid) {
throw new Error(context.getFromSystemTable("VALIDATION_ERROR_MANDATORY_FIELDS") + "\n" + result.missingFields.join("\n"));
}
Parameters
docFile
DocFile
The docfile to validate
fields
string[]
The mandatory fields that should be filled
Returns
object
Object containing the validation result and the missing fields
isValid
isValid:
boolean
missingFields
missingFields:
string[]