Question

3
Replies
25
Views
Close popover
chunliang liu (chunliangl)
Accenture
Manager
Accenture
CN
chunliangl Member since 2015 13 posts
Accenture
Posted: March 30, 2020
Last activity: March 30, 2020

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 Enterprise Application Development Dev/Designer Studio Senior System Architect