Press "Enter" to skip to content

How do you configure Connect-File in Pega


What are the rules involved?

  1. Connect-File.
  2. 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:

  1. Connector name      – Provide the Connect-File name.
  2. 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).
  1. 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.

  1. Connect-File.
  2. 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.

  1. suma suma


    Please give some examples for append or append and map to in data transforms

    • prem prem

      Sure. A post on data transform in coming soon.😊

  2. Sai Krishna Sai Krishna

    great work

    • Premkumar G Premkumar G

      Thank you so much. Please subscribe and stay tuned for new posts.

  3. bhagiradha bhagiradha

    good explanation prem

    • Premkumar G Premkumar G

      Thank you so much. Please subscribe and stay tuned for new posts.

  4. suresh suresh

    Good Explanation prem and provide some Connect-REST and Connect-SOAP examples.

    • Premkumar G Premkumar G

      Thanks Suresh. I will jump to integration topic soon.

  5. syamson syamson

    thank you so much Premkumar.
    can you please post the service SOAP.

    • Premkumar G Premkumar G

      You are welcome, Syamson. Yeah, I’ll post it soon after Connect REST. Please stay tuned. 🙂

  6. Maruthi Maruthi

    Hi Prem
    I am getting the below error.
    Destination Path is “FAIL”
    Destination path is representing a directory “Not Attempted”. I created folder in C drive and gave the same path there. Could you please let me know what is the issue.

    • Premkumar G Premkumar G

      Hi Maruthi,

      You need to note down a main point here.
      You can place a file only in the application server path, not in your laptop or system C/D directory.

      My assumption, your destination path refers to system directories not the Server directory

  7. pradeep pradeep

    I want to where and all we can use connect-file, please give some example scenario based.

    Thank u very much

    • Premkumar G Premkumar G

      hi pradeep,
      In some scenarios, you need to provide an option for users to upload the file. In this scenario – you can use Connect-File from the submit button activity, to place the files in a app server path.
      You can have a file listener / or some other external systems batch process those file from the app server path.

  8. Siva Siva

    Hi Prem,
    Can you explain on how to check application server paths and also brief explanation on it and how pega works in it?

    • Premkumar G Premkumar G

      Hi Siva,
      In real time, You need to have admin access to locate the app server path.
      In personal edition, you can directly try placing the file in your C drive containing PRPC folders.
      Connect-File is my first post 😉 I will try to update the post with more info soon

    • naveen naveen

      Hi Siva,

      You can also use tools like WinScp Or putty to access your application server folders. Even for this we need to have administrator credentials like user name and password.

  9. Rupesh Rupesh

    Hi Prem,

    I got a small doubt by looking at the comments above.

    In some situation you told that we can use file which is present in C directory and and in other case you are telling we cant use it .

    only server directory and application server path can be used .

    Can you please clear on it .

    Rupesh M

  10. Rohan Rohan

    Hi Prem ,

    Can we have some detailed explanation about how the attachments are being handled in pega and how can they be zipped and stored/retrieved from the data base.
    Also need to understand how can we send the attachment to some external system

  11. Sravani Sravani

    Hi Prem,

    It’s very Help Full. Can you please write a post on File Listeners which reads PDF files etc..

    • Premkumar G Premkumar G

      Hi Sravani,

      Glad to hear that you find it helpful. 🙂
      Yeah, many people have asked me to post about File listeners. I’ll try to post about that soon. Stay tuned. 🙂

  12. Ashok Ashok

    Hi Prem,

    Thanks for your valuable information.

    Could you please explain, How to access/retrieve files form application server path.


  13. Raj Raj

    Hi Prem,

    In the exception handling mechanism, let’s suppose we didn’t defined any properties to handle exceptions in that case where error value or code will store.

  14. Priyanka Priyanka

    Hi Prem,

    While Selecting the operation as “Write from HTML stream rule”, we are able to display a page list values using pega tags but the HTML tags are getting displayed in the output text file.

    Please help me on this..

  15. rajesh rajesh

    Good explanation. All your blogs are very useful and especially people from other technology also can easily learn by seeing your explanation.

    Could you please provide the details on file listener

  16. dipika dipika

    Hi Prem,

    Your Blog is very much helpful for starters like me in Pega. Please Keep going 🙂
    And Can you please make a note of File Listeners concept for your upcoming posts.

  17. vinod vinod

    Good work…. thanks for sharing your knowledge… Can you please explain file listener concept.

    • Premkumar G Premkumar G

      Thank you so much for your appreciation, Vinod. 🙂 And you are welcome !
      Yeah I’ll post about it soon, since many are asking for that topic. Stay tuned !

  18. Arunreddy Arunreddy

    Hi prem,

    I have a requirement where I need to place an encrypted file in file repository.

    Can you tell me step how extactly I can achieve that


  19. Arunreddy Arunreddy

    We have requirement where we need to encrypt the file and store into the file location can you suggest me how I can do that

  20. Megana Kaluri Megana Kaluri

    Hi Prem,

    That is a very clear explanation on Connect File. I have a doubt regarding Test Connectivity after setting up Connect File rule.

    Is there any chance of getting Test Connectivity for Connect File rule as Success but when the Connector activity referring to the Connect File rule is manually run, the file is not placed in the location though the file location is of the Application Server path?

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!