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.

Support Article

Unable to add custom URL as an attachment to a work object



On using Apache Commons URLValidator class to validate URLs, unable to add a custom URL as an attachment to a work object. Apache Commons URLValidator class does not allow special domains and displays a validation exception.

For example, Custom URL: http://abcdefgh.prv/user/docs/utils?value=123

Error Messages

Invalid value specified for pyURL. Value doesn't adhere to the Validate: pxValidateURL

Steps to Reproduce

  1. Attach a URL to a case using the case attachments feature.
  2. Supply a URL that ends in .prv or any custom URLs.


Root Cause

A defect in Pegasystems’ code or rules. The Apache Commons URLValidator class for validation of URLs was used, which allowed only URLs that ended with '.com'.


Perform the below steps to resolve the issue:
  1. Apply HFix-38081.
  2. Save as .pyURL(Data-WorkAttach-URL) to the ruleset.
  3. Create a new validation rule in the ruleset and include the below code in it and save it.

    if (theValue== null){
    return false;
    String[] temp;
    String delimiter = "://";
    temp = theValue.split(delimiter);

    if(temp.length <= 1 && !(temp[0].equalsIgnoreCase("http")|| temp[0].equalsIgnoreCase("https"))){

    String validURLstr ="^(ht|f)tp(s?)\\:\\/\\/[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\*\\!\\?\\,\\:\\'\\/\\\\\\+=&%\\$#_]*)[.][0-9a-zA-Z%$/&=?]*$";

    return java.util.regex.Pattern.matches(validURLstr,theValue);

  4. Replace the 'pxValidateURL' in pyURL (in the Advanced tab) created in the ruleset with the new validation rule.
  5. Perform a Save As of 'pyValidateURLWrapper' to the ruleset and replace 'pxValidateURL' with the new validation rule name and save it.

Suggest Edit

Published December 15, 2017 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

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

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