Ignore those. 99.9999% of the time they’re red herrings and show up whether your stuff works or not. @bconner what’s the deal with those? Make them go away.
Do you have a view called actionView??
Unless you assign the results of your function response to a view, then the default is actionResult, so yours would read {actionResult.oBuffer}
oh my, as I was proofing my post I saw actionView vs actionResult and just change that, and changed the file type to application/eml in the JS…wow, it’s kind of working now (file is downloaded)
that was a big post to create, it’s kind of like when you can’t find an issue and talk someone thru your code and pow, there it hits you in the face
Probably? This is a bit outside of my knowledge for JS.
Maybe try changing type: 'application/pdf' to type: 'application/octet-stream' or type: 'message/rfc822' Just throwing some stuff out that I saw on StackOverflow. You’ll have to play with it or someone with more JS knowledge can jump in here.
I added a console.log('{actionResult.oBuffer}'); at the start of the script, it’s showing null in the console…makes me wonder about the function response parms again
@hmwillett Show me the function widget’s response properties in App Studio.
they are all like this (empty)
I have made some guesses on what syntax to put but to no avail
Searching for some documentation on this now
I thought the key was that the condition widget expression’s Javascript was referencing the '{actionResult.oBuffer}' properly, it’s not throwing an error but…it’s not getting the data either
ok, sorry…it looks like this: {"oSuccess":1,"oToAddress":null,"oFromAddress":"scott.janisch@olympusgrp.com","oHtmlBody":null,"oCcAddress":null,"oSubject":null,"oBuffer":null}
so, it is null, not sure why, because if I execute the same in rest helper I get this:
"oSuccess": 113,
"oToAddress": "scott.janisch@olympusgrp.com",
"oFromAddress": "scott.janisch@olympusgrp.com",
"oHtmlBody": "<html><head><style>p { margin-top: 0 ; margin-bottom: 0 ; }</style></head><body><h1>MKE CHANGE FORM</h1><hr><br><p>Customer Name: TEST, INCC.</p><p>Job: 879940-1-1</p><p>Required Date: 4/14/2023 (release 1)</p><p>Traveler Location: 10: ARTSET</p><br><hr><br><p>Is someone from Olympus aware of or working on this change?     Yes / No, If so, who?</p><p>        Was change already made or are they waiting for a new traveler?     Made / Waiting</p><br><p>Further Approval Needed? Yes / No</p><br><p>Requested Ship Date (if changing): </p><br><p>Change(s):</p><br><p>Additional Information:</p><br><hr><br><p>Email this form to the distro with above information filled out. </p><br><p>- If the job is in production, SALES must pull traveler and bring to engineering</p><p>       - Not needed if the only change is moving the date OUT </p><p>       - Contact scheduling to discuss first if moving the date UP</p><br><p>- If the job is OFA, do NOT mark the approval operation complete. </p><p>       - Engineering will do so AFTER the change is made. </p></p></body></html>",
"oCcAddress": "scott.janisch@olympusgrp.com",
"oSubject": "MKE Change Form",
"oBuffer": "X-Unsent: 1\r\nX-Sender: scott.janisch@olympusgrp.com\r\nX-Receiver: scott.janisch@olympusgrp.com\r\nX-Receiver: scott.janisch@olympusgrp.com\r\nMIME-Version: 1.0scott.janisch@olympusgrp.com\r\nFrom: scott.janisch@olympusgrp.com\r\nTo: scott.janisch@olympusgrp.com\r\nCc: scott.janisch@olympusgrp.com\r\nDate: 3/31/2023 9:55:09 AM\r\nSubject: MKE Change Form\r\nContent-Type: text/html; charset=us-asciiscott.janisch@olympusgrp.com\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n<html><head><style>p { margin-top: 0 ; margin-bottom: 0 ; }</style></head><body><h1>MKE CHANGE FORM</h1><hr><br><p>Customer Name: TEST, INCC.</p><p>Job: 879940-1-1</p><p>Required Date: 4/14/2023 (release 1)</p><p>Traveler Location: 10: ARTSET</p><br><hr><br><p>Is someone from Olympus aware of or working on this change?     Yes / No, If so, who?</p><p>        Was change already made or are they waiting for a new traveler?     Made / Waiting</p><br><p>Further Approval Needed? Yes / No</p><br><p>Requested Ship Date (if changing): </p><br><p>Change(s):</p><br><p>Additional Information:</p><br><hr><br><p>Email this form to the distro with above information filled out. </p><br><p>- If the job is in production, SALES must pull traveler and bring to engineering</p><p>       - Not needed if the only change is moving the date OUT </p><p>       - Contact scheduling to discuss first if moving the date UP</p><br><p>- If the job is OFA, do NOT mark the approval operation complete. </p><p>       - Engineering will do so AFTER the change is made. </p></p></body></html>"
}```
Somehow, the method parameters were gone, argh, so now my response looks correct !
I wonder if it was because I was moving steps around, adding/removing steps (not that one tho)
I did not know about the network tab things, thanks
I am now getting an error on the JavaScript hack: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
I can try some things to work through that…so close
Ah, ok, but I can use console.log in the JavaScript “hack”…that’s probably what I need now
@josecgomez
using the JavaScript “hack” to download a file, successfully passing my “blob” via window.atob('{actionResult.oBuffer}') but oBuffer is an output from a function, typed as a String, see any issues there ?
X-Unsent: 1X-Sender: scott.janisch@olympusgrp.comX-Receiver: scott.janisch@olympusgrp.comX-Receiver: scott.janisch@olympusgrp.comMIME-Version: 1.0scott.janisch@olympusgrp.comFrom: scott.janisch@olympusgrp.comTo: scott.janisch@olympusgrp.comCc: scott.janisch@olympusgrp.comDate: 3/31/2023 2:38:28 PMSubject: MKE Change FormContent-Type: text/html; charset=us-asciiscott.janisch@olympusgrp.comContent-Transfer-Encoding: quoted-printable<html><head><style>p { margin-top: 0 ; margin-bottom: 0 ; }</style></head><body><h1>MKE CHANGE FORM</h1><hr><br><p>Customer Name: TEST, INCC.</p><p>Job: 879940-1-1</p><p>Required Date: 4/14/2023 (release 1)</p><p>Traveler Location: 10: ARTSET</p><br><hr><br><p>Is someone from Olympus aware of or working on this change? (continues)
but a rest response shows there should be \r\n to break the lines up
in a test program, if I take my oBuffer and convert it to a Byte[] the \r\n become 0x0d 0x0a as one would expect and then if I write that Byte[] to a file and name it as .eml, it opens as an email draft
this is the first part of oBuffer in my rest response:
That’s not base 64 encoded. atob needs a base 64 encoded string. Looks like yours is already decoded. Do return a Byte Array from your function take the File and turn it into a byte array.
Yeah, I eventually realized the thing about not being 64 encoded, so my attempt was to fix it in the javascript, I had removed the atob and replaced with various outher attempts, to no avail.
Fixing it on the other side (your suggestion) hadn’t occurred to me…eureka…it worked !!!