This function allows you to attach files to an instance and linking it to an attachment field.
Parameter |
Type |
Description |
|---|---|---|
$filepath |
string |
Complete path to the file that should be attached |
$fieldname |
string |
Name of process table or subtable column |
$row |
int |
ID of a row within a subtable (optional) |
$subtable |
string |
Subtable name (optional) |
The function does not return a value. In case of an error a JobRouterException is displayed.
Example:
…
//Attach to process table
$filepath = 'c:\temp\costcenters.txt';
$this->attachFile($filename, 'ATTACHMENT');
//Attach to subtable
$this->attachFile($filename, 'ATTACHMENT', 1, 'ITEMS');
…
Please note: Attachments are correctly attached to the instance within step initiation and form functions only if the function save() is called thereafter to save the step.
Example:
…
$filepath = 'c:\temp\costcenters.txt';
$this->attachFile($filename, 'ATTACHMENT');
$this->attachFile($filename, 'ATTACHMENT', 1, 'ITEMS');
…
// save step
$this->save();
…