File Connector Guide > Process Objects with File Connector > Event Target Process Objects

Event Target Process Objects

Event Target definitions enable you to work with process objects to write files and serialize delimited content.

File Writer

When you publish a connection that includes a file writer definition as an Event Target, Process Designer also creates a service.
The FileWriteTask process object contains the name of the target file, the relative file path (based on the event target's base directory) and the string content to write to the target.

<!-- file path, if required, which must be relative for FTP/SFTP -->
<filePath> documents </filePath>
<!-- target file name -->
<fileName> test.txt</fileName>

<!-- content format, which determines the applicability of other fields -->

<!-- applies only if format is PlainText or Binary - if Binary, content is Base64-encoded string -->
<content>Test file content</content>

<!-- applies if content is XML or JSON, in which case, use object or objects -->
<object>process object</object>
<objects>a list of process objects</objects>

<!-- optional, peovide the ObjectName and listName -->

Note: If the file or any folders in the path do not exist, they are automatically created.
For details on the FileInformation process object, see File Information Process Objects.

Delimited Content

When you publish a connection that contains a delimited content event target, Process Designer creates a service that you can use to serialize your process objects into a delimited file.
You can serialize both delimited content process objects, which represent the general model of a delimited content file, and custom process objects.

Serialize Custom Process Objects

The process objects created to handle delimited files in an Event Target are:
  1. 1. Use SerializeToDelimitedContentTask to access the request object.
  2. 2. Use SerializeToDelimitedContentResult to access the results of the serialization.
For example:
<!-- for FTP/SFTP only -->

<fileName> users2.csv </fileName>
<filePath> CustomModelProcess </filePath>
<delimiter> ; </delimiter>
<skipHeaders> true </skipHeaders>
<Email> </Email>
<Password> 222222 </Password>
<Phone_number> 333-3333-5554 </Phone_number>
<User_name> Bob </User_name>
<Email> </Email>
<Password> 3333 </Password>
<Phone_number> 444-222-111 </Phone_number>
<User_name> Bill </User_name> </customObjects>
<name> User_name </name>
<fieldIndex> 1 </fieldIndex>
<name> Phone_number </name>
<fieldIndex> 2 </fieldIndex>
<name> Password </name>
<fieldIndex> 3 </fieldIndex>
The request should include the target file name, relative file path, and a list of custom objects.
Note: You can also provide delimited and text qualifier characters if you need to overwrite default values that are set in the event target's properties. For example, you might want to overwrite the skipHeaders attribute if you generate process objects one by one. In that case, you can write headers in the first record and then skip headers as you append all other records in the file.

Handling Headers

Process Designer can automatically serialize simple objects but skips complex fields (such as references and object lists) when using the custom process objects. The generated file includes a list of headers using the first process object's simple field names. Sometimes this method is useful but it has several disadvantages:
You can eliminate these disadvantages if you include a set of custom headers in a request object. Process Designer then uses the headers to generate delimited records with only the specified fields in the specified order.
Note: Use custom headers only if you serialize custom process objects. If you serialize a built-in delimited content process object, it already contains information about headers so there is no need to use custom headers.

Serialization Results

Whatever approach you take, after each file is processed, the results display:
For example:
<processedRecordsCount> 10 </processedRecordsCount>
<writtenRecordsCount> 8 </writtenRecordsCount>
<success> true </success>
<fileInfo> <lastModified> 2015-05-15T14:07:11.475Z </lastModified>
<dir> D:/MyDirectory/DelimitedFiles/CustomModelProcess </dir>
<name> users2 </ns7:name>
<path> D:/MyDirectory/DelimitedFiles/CustomModelProcess/users2.csv </path>
<fullName> users2.csv </fullName>
<ext> csv </ext>
<size> 116 </size>