Question
Accenture
CN
Last activity: 30 Mar 2020 23:28 EDT
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
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","");
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
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.