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

Page error message wiped off due to section reload

SA-94850

Summary



Page error messages are erased when the ReloadSection activity is invoked (unexpectedly) for the pyFeedInner section.


Error Messages



Not Applicable


Steps to Reproduce



Submit an Assignment.


Root Cause



A defect in Pegasystems’ code or rules.


Resolution



Perform the following local-change:
  1. Open the UserWorkForm rule.
  2. Save As to the application ruleset (if not saved already).
  3. Copy and paste the below code snippet.

    <script>
      pega.u.d.attachOnload(function(){

     if( pega.ui.template.pzRDLTemplate && pega.ui.template.pzRDLTemplate ){

         pega.ui.template.pzRDLTemplate.loadPage = function(startIndex, pageCount, RDLNode, event, callback,fromFetchAndAppend) {
            if(startIndex<pageCount) return;
              var dataSource = RDLNode.getAttribute('data-repeat-source');
      
              var isLargeDP = false;
              var dpName = dataSource.substring(0, dataSource.indexOf("."));
              var isLargeDP = pega.ui.ClientCache.isLargeDatapage(dpName);
              var endIndex;
      
              /* Fetch the pageList with the required set of rows. */
              /* Set the start and endIndex. */
              startIndex = parseInt(startIndex);
              pageCount = parseInt(pageCount);
              endIndex = startIndex + pageCount - 1; /* BUG-379365 */
              if(pageCount == -1) endIndex = -1;
              
              var options = {
                  startIndex: startIndex,
                  endIndex: endIndex,
                  pageCount:pageCount
              };
              if(fromFetchAndAppend) options.fromFetchAndAppend = true;  
              var callbackObj = {
                success: function(responseObj){
                  /* Check if there are any errors and do not proceed with page rendering */
                  var reloadElement = responseObj.argument[0];
                  /* Check for exceptions and abort if any are found */
                  if (pega.u.d.checkExceptions(responseObj.responseText, reloadElement)) {
                    pega.u.d.inCall = false;
                    if (pega.u.d.changeInEventsArray) pega.u.d.changeInEventsArray.fire();
                    pega.u.d.gBusyInd.hide();
                    return;
                  }                        
                  
                  /* US-265871: Do not return without rendering the next set of rows */
                  pega.u.d.handleErrorAfterPartialSuccess(responseObj);
                  if(!isLargeDP) {
                    pega.ui.template.pzRDLTemplate.loadNextPage(responseObj.responseText,RDLNode,callback,options);
                  }
                  responseObj.argument = null;
                  pega.u.d.gBusyInd.hide();
                },
                failure: function(){
                  console.log("Pagination failed");
                }
              };
            
            var oArgs = {
                  "strReloadType": "partial-refresh",
                  "reloadElement": RDLNode,
                  "bFormSubmit": false,
                  "bSectionSubmit": false,
                  "event" : event,
                  "callback": callbackObj,
                  "pzKeepPageMessages": true, /* US-265871: Preserve errors*/
                  "preActivity": callback ? "" : "pzInvokeRDLPreProcessing" /*BUG-381209: Tagging the extension point activity to the reload infrastructure*/
                };
            if(pega.u.d.ServerProxy.isDestinationLocal()) {
              oArgs.partialMetadataPath = RDLNode.getAttribute("data-path"); /* partialMetadataPath is used in renderUI callback to retrive partial metadata. */
              oArgs.generateMetadataFn = function(rdlMetadata) { /* Partial metadata retrieved from partialMetadataPath is passed to this method. This method updates the metadata with next page info and keeps the metadata inline to "nextPage" renderer. */
                    var TEMPLATE_CONSTANTS = pega.ui.TEMPLATE_CONSTANTS;
                    rdlMetadata.pyName = "nextPage";
                    rdlMetadata[TEMPLATE_CONSTANTS["PYSTARTINDEX"]] = startIndex;
                    rdlMetadata[TEMPLATE_CONSTANTS["PYENDINDEX"]] = startIndex + pageCount - 1; /* TODO: Need to verify this after US-226992 changes tweaked the calculation */
                    if(rdlMetadata.section && 
                       rdlMetadata.section.sectionbody[0] && 
                       rdlMetadata.section.sectionbody[0][TEMPLATE_CONSTANTS["PYPAGELISTPROPERTY"]]) {
                      rdlMetadata[TEMPLATE_CONSTANTS["PYPAGELISTPROPERTY"]] = rdlMetadata.section.sectionbody[0][TEMPLATE_CONSTANTS["PYPAGELISTPROPERTY"]]; /* This is needed to keep the metadata inlint to "nextPage" renderer. */
                    }
                    if(isLargeDP) { /* RDL node is used by "nextPage" renderer to load page and its reference is cleared after usage. */
                      rdlMetadata.RDLNode = RDLNode;
                    }
                  };
              } else {
                var oSafeURL = new SafeURL();
                oSafeURL.put("listAction", "PAGINATE"); /*BUG-381209: Appending necessary param for the pyPreListAction activity*/
                oSafeURL.put("listPageSize", pageCount);
                oSafeURL.put("pyCallStreamMethod", RDLNode.getAttribute('data-nextpagemethod'));
                oSafeURL.put("listSource",dataSource);
                if(startIndex)
                  oSafeURL.put("listStartIndex", startIndex);
                if(endIndex)
                  oSafeURL.put("listEndIndex", endIndex);
                oArgs.appendExtraQueryString = oSafeURL;
              }
            
            if (pega.u.d.isSafeToReload(RDLNode)) {
     pega.u.d.reload(oArgs);
            } else {
              setTimeout(function() {
                pega.ctx.RDL.isLoading = true;
                pega.ui.template.pzRDLTemplate.loadPage(startIndex, pageCount, RDLNode, event, callback);
              }, 0);
            }
        };
    }
      } );
    </script>

  4. Save and Check In the rule.
  5. Test the scenario.

Published December 2, 2019 - Updated December 2, 2021

Was this useful?

100% found this useful

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

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