Author Topic: Messagebox and the use of await  (Read 342 times)

CemKoese

  • Newbie
  • *
  • Posts: 5
    • View Profile
Messagebox and the use of await
« on: October 28, 2020, 04:27:49 pm »
Hello,

i have an issue with the code displayed in the Wiki:

let msgBoxResult = await brixxApi.messageBox({
     title: "sampel title",
     text: "sampel text",    ....


I changed the "let msgBoxResult = brixxApi.messageBox" to
"let msgBoxResult = app.messageBox".

As far as i know, we shouldn´t need the "await" anymore, if we use "app." instead of "brixxApi.".

Unfortunately it does not work without the "await", when i combine it with a
app.compose Email.


Here is my full code:

let sendMail = await app.messageBox({
    title: "Email Versenden?",
    buttons:[
        {
        title: "Ja",
        value: "1"
        },
        {
        title: "Nein!",
        value: "2"
        }
    ]
});


if(sendMail == 1){
    app.composeEmail({
    text: "the text",
    to:["email"],
    subject: "Subject",
    from: "fromMailAddress",
    autoSend: true,
    attachmentBlobs: [
        {
        name: "",
        blob: myBlob = app.createReport("reportControl")
        }
    ],
});
}




Is it intended, that we still need the await here?
« Last Edit: October 28, 2020, 04:36:50 pm by CemKoese »

volker.thebrath

  • Administrator
  • Newbie
  • *****
  • Posts: 46
    • View Profile
Re: Messagebox and the use of await
« Reply #1 on: October 28, 2020, 06:32:03 pm »
Hi Cem,

you don't need an await in your case, as in most cases.
The issue here is an incorrect syntax in the compose statement. Actually, the wiki page had a wrong example.  You have to remove the "myBlob =". I fixed the wiki page


attachmentBlobs: [
        {
        name: "",
        blob: app.createReport("reportControl")
        }
    ],


CemKoese

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Messagebox and the use of await
« Reply #2 on: October 29, 2020, 11:01:11 am »
Thank you Volker,

afterwards i tried a different appraoch, as you said the await was not the problem.

Problem solved.