Question

3
Replies
22
Views
chunliangl Member since 2015 8 posts
Accenture
Posted: 7 months ago
Last activity: 7 months ago

Is there any bug in my Solution?

I try to click an button to download a pdf file for user. but I don't want use action[Open URL in window]. So I use JS to call my Activty for this.like below

https://community.pega.com/support/support-articles/document-download-performed-only-link-clicked-first

But a bug is happened. when I first click button is work well. but Second click this button  [Action not allowed as it is outside current transaction] error is happened.

So I add some JS code for this. (// add code start and // add code end)Now it is work well. Is there any bug in my Solution?

============================================================  

function downloadFile(activityName, className, applicationName){     var suURL = SafeURL_createFromURL(pega.u.d.url);     suURL.put("pyActivity", activityName);     suURL.put("pyClassName", className);     suURL.put('ApplicationName', applicationName);          // add code start      suURL.put("pzFromFrame","");

    // add code end     var formEle = document.createElement('form');          formEle.id = "download_file";     formEle.method = "POST";     formEle.action = suURL.toURL();     if(pega.env.ua.webkit)formEle.target = "";          document.body.appendChild(formEle);     formEle.submit();          document.body.removeChild(formEle);    

    // add code start 

    var url = document.forms[0].action;     var formURL = SafeURL_createFromURL(url);     formURL.put("pzFromFrame","");;     document.forms[0].action= formURL.toURL();

    // add code end

  } 

=================================================

 

could you give me some suggestion for this. Thank you very very much.

Pega Knowledge 8.2 Low-Code App Development Dev/Designer Studio Senior System Architect
Share this page LinkedIn