Skip to main content
This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.
LinkedIn
Copied!

How to write a file to the local file system using a file connector

Summary

Your application can write files to the file system of the Process Commander server using Connect File rules. The generated file may contain the contents of an HTML or XML Stream rule, an eForm document, a work object attachment, or a clipboard property.

 

Suggested Approach

To implement a file connectorr:

  1. From the Application Explorer, create a new Connect File rule by selecting New > Rule > Integration-Connectors > Connect File.
  2. On the Connect File form, complete the necessary fields.
    Connector
      • Destination Path — Enter the location on the PRPC server for the file..
      • File Name — Enter the name and extension of the file.
      • If File Already Exists — Select the action to take if the specified file is already present in the location. The options are Fail, Append, or Overwrite.
      • Keep File Open — Select to enable multiple iterations of the Connect-File method to write to the file, without having to open and reopen the file. If this option is selected, your application processing must eventually execute another Connect-File method with the Close File operation.

Note: Optionally, you can use the global resource setting syntax =PageName.Property for the File Name parameter.

  1. In a new or existing activity, add a step that invokes the Connect-File method.
    Activity

    In the step parameters section, fill in the following fields:
    Parameters
      • ConnectorName — Using the SmartPrompt, select the Connect File rule you created earlier.
      • Operation —Select the operation used to create the file. The options are:
        Operation Parameter
        Write from HTML Stream Rule The name of an HTML rule instance defined in the step page class.
        Write from XML Stream Rule

         

        The name of an XML rule instance defined in the step page class. The third key part of this XML rule must be 'MapFrom'.
        Write from eForm

         

        The name of a page of class Code-Pega-eForm.
        Write from Work Attachment

         

        The name of a page of class Data-WorkAttach-File that holds the work object attachment.
        Write from Clipboard Property

         

        The name of a property (defined in step page class) with or without a leading period, or using the PageName.PropertyName method.

        Close File

        Closes the file to disable writing more content. Use when the Keep File Open option is selected in the Connect File rule to end processing of a file.
      • Parameter — Enter the name of or reference to the input data source, as described in the Operation field. For example if the Operation is Write from HTML Stream Rule, then provide the StreamName of the html rule (Rule-Obj-HTML instance) in the Parameter field. If the input value contains a "." character, the system will look for a property rule. You can also input literal values by surrounding the text with double quotes, or complex function calls.
If the Operation is Close File, you can leave the Parameter field blank.
  1. If you are writing a file as a part of flow processing, add an Integrator shape to your flow that references the Activity rule you edited or created in step 3. The referenced activity rule should be of the type Connect.
Suggest Edit
Did you find this content helpful?

76% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us