Skip to main content
LinkedIn
Copied!

Table of Contents

Troubleshooting FilePath issues

Learn how to configure FilePath control with its parameters, the symptoms and root causes of issues related to the FilePath control in your Pega applications, and how to prevent and resolve them. The scenarios describe issues with the FilePath control that users have reported.

Configuring FilePath control

Changes required for existing custom controls in AJAX

Scenario 1: FilePath control causes error on the portal work area

Scenario 2: Refresh section does not work with FilePath control

Scenario 3: FilePath control does not set pxRequestor.pyFileUpload property

FilePath control limitation

Debugging

Configuring FilePath control

To configure the FilePath control, follow these steps:

  1. Edit the FilePath section.
  2. Open Cell Properties.
  3. Click Parameters.
Configuring FilePath control with its parameters
"Navigate to FilePath > Cell Properties > Parameters. "
Configuring FilePath control with its parameters

Parameters in Cell Properties

pySetValueFromFileName(String)

This parameter specifies an element to be updated onChange of the selected file.
Here, the hidden text field of same name must display on the holding section to ensure that the value is posted with the submission of the form. Ensure the pySetValueFromFileName(String) parameter receives the property name in double quotes.

Use the pxRequestor.pyFileUpload parameter to obtain file path.
 

SetEncodingNow(Boolean)

Check this field to immediately update file encoding on file selection.
Ensure this property is checked for cases like the FilePath control in modal, Overlay or AJAX container. 
This internally invokes the following JavaScript code:

pega.ctx.setFormEncoding(true);   

Changes required for existing custom controls in AJAX

If you have implemented custom controls, use the Set Encoding and Reset Encoding APIs for file encoding in the FilePath control to work inside the AJAX container.

Do not use the Set Encoding and Reset Encoding APIs when an out-of-the-box control is used and cases are non-AJAX container cases. 

Invoke the following API onChange of the file input control. This ensures that the file input control is familiar with the context and the encoding is set on the correct context.

    Set encoding

    pega.ctx.setFormEncoding(true);  
    

    Reset encoding

    pega.ctx.setFormEncoding(false);  
    

    FilePath control with non-AJAX container and direct form submit is as follows: 

    function updateFormEncoding(){ 

      var oForm = document.forms[0]; 

      if(oForm) 

      oForm.encoding = "multipart/form-data"

     

    FilePath control with support for AJAX container is as follows:

    function updateFormEncoding(){ 

      pega.ctx.setFormEncoding(true); 

    }

    Scenario 1: FilePath control causes error on the portal work area

    FilePath control causes an error on the portal work area. However, it works correctly on the out-of-the-box Profile page.

    Error

    Error : pxFileNotFound on D_pzOperatorInfo page under pzFileUploadgadget.

    Explanation

    Workarea (inner harness) is disabled for harness. Hence, the modal dialog loads as sibling instead of child to the harness in the Document Object Model (DOM).

    Solution (or Suggested Approach)

    Enable Workarea (inner harness) on the Advanced tab of harness in which the FilePath control is configured.

    See SA-98705, FilePath control behavior incorrect.

    Scenario 2: Refresh section does not work with FilePath control

    Users upload images and attachments for display in the user interface. On click of a button, a PDF report generates on a new window defined in the activity logic and the section refresh is rendered. A button must display on the UI based on the visibility flag condition, on performing a refresh. However, the Refresh section action fails, the activity defined in the action set does not get invoked, and the button does not display on performing Refresh.

    Explanation

    The root cause of the issue is the timing. The openUrlInWindow action does not pause the Event queue. The Refresh section action executes before the openUrlInWindow activity because the Refresh section action requires less time than the Refresh harness action. You can see this in the Tracer.

    Solution

    1. Use a separate activity to set the flag and invoke it with the Run activity action, and then the Open URL in window action with an earlier PDF generation activity. The final action can be Refresh section.

    2. Perform a Catch Block for Filename property in the FilePath control.

    See SA-80402, Refresh section does not work with FilePath control.

    Scenario 3: FilePath control does not set pxRequestor.pyFileUpload property

    As an application developer, you discover that you cannot set the pxRequestor.pyFileUpload property using the FilePath control. This occurs on opening the control in a flow instead of a modal dialog.

    Explanation

    You need to submit a form for the FilePath control to set the path on the Clipboard.

    Solution

    Use the pyFilePathWithForm property to set the path on the Clipboard.

    See SA-95933, FilePath control does not set pxRequestor.pyFileUpload property

    FilePath control limitation

    The most recently updated FilePath control is available on the server. Multiple FilePath controls cannot exist on a page. The last control value updated overrides the value set on the pxRequestor.pyFileUpload parameter that is on the clipboard.

    Debugging

    • Set the Encoding Type for Direct form element and FormData object as follows for both AC and non-AC cases:
      multipart/form-data, when a file path control is present in it

    • Verify the path of the file that is uploaded under the pyFileUpload property on the pxRequestor page on the clipboard.
      The pxRequestor.pyFileUpload parameter must hold the current file selected.

    • The pySetValueFromFileName parameter internally adds an onChange event listener to the FilePath control. The parameter also updates the hidden control property of the same name with a new value. Check Callback if the property is not set with the filename.

    • Enable the SetEncodingNow option on the FilePath control parameters in the AJAX or non-AJAX containers if the file is not submitted.

    In versions prior to Pega 8.1, when FilePath control is configured in modal, the property of the modal is submitted along with the entire form on submit of the modal. However, in versions later than Pega 8.1, when FilePath control is configured in modal, only the property of the modal is submitted on submit of the modal. The entire form is not submitted. Configure the property in modal as hidden text to submit the entire form.
    Did you find this content helpful?

    100% found this useful


    Related Content

    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