Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Experimental Features
Answered

Power Apps Email automation

(3) ShareShare
ReportReport
Posted on by 11

Hey people,
what I was trying to do was writing an app in POWER APPS for sending an automated Email by ticking a checkbox for example in a Power BI Report. The Mail adresses should be taken out of an excel sheet and in there is also a list of work package numbers which should get a checkbox each. I'll show you in the annex how its supposed to look.
the code:


Clear(colGenehmigteWQs);

 

ForAll(

Gallery1.AllItems,

If(

!Checkbox_Unapprove.Value,

Collect(colGenehmigteWQs, ThisItem)

)

);

 

Set(mailText,

"Folgende WQs wurden genehmigt:" & Char(10) &

Concat(

colGenehmigteWQs,

"• " & ThisRecord.WQ & Char(10)

)

);

 

Set(mailEmpfaenger,

Concat(

Distinct(colGenehmigteWQs, Email),

Result & ";"

)

);

 

Office365Outlook.SendEmailV2(

mailEmpfaenger,

"Ihre genehmigten WQs",

mailText

);

 

Notify("✅ E-Mail wurde gesendet.", NotificationType.Success)

 

and the error i get is : unexpected signs. Characters are not used as expected in the formula

 

Thank you in advance!

  • ACC_Entwickler Profile Picture
    11 on at
    Power Apps Email automation
    @ronaldwalcott Thank you so much for your help, but somehow I still had one syntax error left. 
     
    @WarrenBelz Thank you very much, I copied your code and it worked right away, and everything I tried worked! 
  • Verified answer
    WarrenBelz Profile Picture
    146,660 Most Valuable Professional on at
    Power Apps Email automation
    Just throwing in a different approach - based on what you posted - you do not need those collections. I am assuming here that the gallery contains both the items (WQ) to be listed and the email address to send it to.
    With(
       {
          _Data: Filter(
             Gallery1.AllItems,
             !Checkbox_Unapprove.Value
          )
       },
       With(
          {
             _Body: Concat(
                _Data,
                WQ,
                Char(10)
             ),
             _Mail: Concat(
                Distinct(
                   _Data,
                   Email
                ),
                Value,
                ";"
             )
          },
          Office365Outlook.SendEmailV2(
             _Mail,
             "Ihre genehmigten WQs",
             _Body
          )
       )
    );
    Notify(
       "✅ E-Mail wurde gesendet.", 
       NotificationType.Success
    )
    Also if you are using European syntax, it may be this
    With(
       {
          _Data: Filter(
             Gallery1.AllItems;
             !Checkbox_Unapprove.Value
          )
       };
       With(
          {
             _Body: Concat(
                _Data;
                WQ;
                Char(10)
             );
             _Mail: Concat(
                Distinct(
                   _Data;
                   Email
                );
                Value;
                ";"
             )
          };
          Office365Outlook.SendEmailV2(
             _Mail;
             "Ihre genehmigten WQs";
             _Body
          )
       )
    );;
    Notify(
       "✅ E-Mail wurde gesendet.";
       NotificationType.Success
    )
     
  • ronaldwalcott Profile Picture
    3,530 on at
    Power Apps Email automation
    You have to convert it to your locale.
    Don't you use ; where I use , 
  • ACC_Entwickler Profile Picture
    11 on at
    Power Apps Email automation
    @ronaldwalcott
    Thank you for your help so far. So I did what you said, and now I get 3 errors again. First one at the first opening bracket after ClearCollect (invalid number of arguments.received:1, expected: 2 or more)
    second and third error right after the colGenehmigteWQs,
    2: (unexpected signs. The formula contains "error", but "parenClose" is expected)
    3: (unexpected signs. Characters are used unexpectedly in the formula)
     
  • ronaldwalcott Profile Picture
    3,530 on at
    Power Apps Email automation
    I don't understand how you are creating the collection but try this 
     
     
    ClearCollect(colGenehmigteWQs, First(Filter(Gallery1.AllItems, !Checkbox_Unapprove.Value)));
    Clear(colGenehmigteWQs);
     
    to replace just using
     
    Clear(colGenehmigteWQs);
     
    at the start of the code that you have shown.
     
    This will create an empty collection in the correct format.
    I don't know the purpose of the checkbox in the gallery I used it above but you could probably just use the first item in the gallery to configure the collection. 
  • ACC_Entwickler Profile Picture
    11 on at
    Power Apps Email automation
    Hey, 
    I have not created it. I asked AI for help and it told me that the collection will be created by tickiing the checkbox. This seemed wrong for me, so I asked again and he said I should put it to OnStart with 
    ClearCollect(colGenehmigteWQs; {})
    So I did that.

    What is your solution for this maybe and how should I create the collection?
  • ronaldwalcott Profile Picture
    3,530 on at
    Power Apps Email automation
    Have you created the collection that you are trying to Clear?
    Please show where you first create the collection.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard

Featured topics