What are the rules involved?
- Connector activity.
What is Connect-File?
- A connector rule falls under Integration-Connectors category.
- The main purpose of this rule is to create a file and place it in the mentioned App server directory.
How to configure Connect–File?
- Create a new Connect–File rule from Integration category ( No wizard available).
- Three blocks are there in the service tab.
1. File system
Destination Path : Provides a directory path of the App server. This is the path where you can see your file.
File Name : Name of the file to be created.
If File Exists : If a duplicate file name is already there in the directory path, then
a) Fail – End the connection
b) Append – Append to the end of existing file
c) Overwrite – Replace existing file
Enable BOM : True / False.
What is BOM?
Byte Order Mark. Whenever you save a notepad file, you may come across ï»¿ character at the start. These are useful to identify which byte order or which encoding methods (UTF-8) are used. These will be used for decoding purposes. Pega recommends enabling BOM, if CSV data are exported to Excel.
2. File connection handling
Keep File Open : True / False
Imagine a scenario where you need to update the same file again and again with different Connect-File methods. Check Keep File Open to true to enable this function. Remember to close the file on the final Connect-File method.
3. Error Handling
This is same for all connectors. Holds the status value and message in property values. Leave it as-is.
How to test the Connect–File?
After configuring, use Test connectivity button to validate the destination path configuration.
If some error comes, then please check if the destination path provided is a valid directory in App server.
How to invoke a Connect-File?
Method 1. Create a new connector activity and use Connect-File Method.
Connect-File method accepts 3 parameters:
- Connector name – Provide the Connect-File name.
- Operation – Many operations are available.
- Write from HTML stream rule (Copy the HTML content to file).
- Write from XML stream (Copy the XML to .xml file).
- Write from eForm (Used to create a PDF file).
- Write from work attachment (Used to move the work object attachment).
- Write from clipboard (Copy the clipboard property containing data to file).
- Close file (Use this in last Connect-File method when keep file open is true).
- Parameter – Set parameter value based on the operation value you select.
- Can refer stream, property , literals etc.
Method 2. From flow Integrator shape
- Flow –> Advanced Shapes –> Integrator utility.
- Use the activity same as above of type ‘Connect’.
How to debug the Integration?
Scenario: Create a text file containing string “This is a test String” and place it in C:\TMP directory in App server path.
Step 1: Create the Connect-File as shown above.
Step 2: Create a new connector activity.
-Use Operation mode as “Write from clipboard property” with parameter set from step 2.
Step 3: Manually run the activity and check the App server path C:\TMP
Note : In many applications only system administrator have access to Server.
Step 4 : Open the text file.
Where a file gets created ?
We can see that only 2 rules are involved in File Integration.
- Connector Activity.
You may get a question “Where the file gets created? How the mapping from data source is handled?”
Ans: When the Connect-File method calls OOTB activity, Rule-Connect-File.Invoke gets executed. The 500 line java step is solely responsible for creating the file and moving to the required directory. No need to worry about this activity.
Complete those two configuration points and Pega does the rest.