This is a new post, trying to use some of the techniques from these two posts:
This is Kinetic Web, not classic, and we are Hosted
-
I’ve written a function that gathers data and creates a “blob” which is meant for a “.eml” file.
-
This email file is “tweaked” by the user before sending, so for now I need to use the Javascript (hack ) from @jcgomez and @hmwillett to send it to the client as a downloaded file to open.
-
I have a button, with event that calls my function, and I’m putting a condition after the function to try to get my output blob and pass it to the JScript…but I am having trouble getting the syntax correct
This is my event handler:
This is my function signature:
At this point I’m only interested in my output param “oBuffer”
My Condition/Param/Expression is set to:
The full expression being:
eval ("var byteString = window.atob('{actionView.oBuffer}');let int8Array = new Uint8Array(new ArrayBuffer(byteString.length));for (let i = 0; i < byteString.length; i++) { int8Array[i] = byteString.charCodeAt(i);}let documentBlob = new Blob([int8Array], { type: 'application/pdf' });let fileURL = URL.createObjectURL(documentBlob);console.log(fileURL); window.open(fileURL,'_blank');")
The only change I needed to make was at window.atob('{actionView.oBuffer}')
‘actionView.oBuffer’ is my blob of data (really a string, see error, next)
On my function widget I have not set any of the response parameters (possible issue ?)
Using F12 (and ctrl-alt-8), I see these errors:
Note, all my output params are assigned a value of the correct type in the function,
but for some reason oBuffer and oSuccess don’t show one of the errors (in yellow),
also note the “actionResult.returnObj” which is not one of my return params.
For the error in red relating to atob, I’m thinking that’s because oBuffer is one of the params error’d in the yellow section.
I know that’s alot of info, but hopefully many can learn from any help provided.
Thanks for any thoughts