Hi,
I made a form in powerapps, when i hit on send button in the app the contents will be send to a sp list. Now i'm looking for a way to sending it also to my email. Is there a way to do that in the same code? I'm using this code on the 'on select':
ForAll(Gallery1.AllItems;
Patch(Uitgeleend;
Defaults(Uitgeleend);
{Title:Titel;
categorie:Categorie.Value;
barcode:Barcode;
project:Textcart.Text;
datumretour:Datepick.SelectedDate;
aantal: Value (quant.Text)
}
)
)
;;Clear(MyCollection)
;;Navigate(Uitleen)
Thanks!
Solved! Go to Solution.
Hi @MelvinGRM ,
Two things - firstly the Patch will work a lot faster if done as below. Also the Body of the email needs to be a Text String - I have added line breaks as well
Patch(
Uitgeleend;
ForAll(
Gallery1.AllItems;
{
Title: Titel;
categorie: Categorie.Value;
barcode: Barcode;
project: Textcart.Text;
datumretour:Datepick.SelectedDate;
aantal: Value(quant.Text)
}
)
);
ForAll(
Gallery1.AllItems;
Office365Outlook.SendEmailV2(
"mymail@work.com";
"Test";
"Title:" & Titel &
"<br>categorie:" & Categorie.Value &
"<br>barcode:" & Barcode &
"<br>project:" & Textcart.Text &
"<br>datumretour:" & Text(Datepick.SelectedDate, "dd/mm/yyyy") &
"<br>aantal:" & quant.Text & "<br>"
)
)
);;
Clear(MyCollection);;
Navigate(Uitleen)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
hi @MelvinGRM yes you can do that, if you want to send an email for every record do the following:
Add the Office365Outlook connector
Alter code as follows
ForAll(Gallery1.AllItems;
Patch(Uitgeleend;
Defaults(Uitgeleend);
{Title:Titel;
categorie:Categorie.Value;
barcode:Barcode;
project:Textcart.Text;
datumretour:Datepick.SelectedDate;
aantal: Value (quant.Text)
}
);
Office365Outlook.SendEmailV2(
"your Email",
"your Subject",
Title:Titel
categorie:Categorie.Value
barcode:Barcode
project:Textcart.Text
datumretour:Datepick.SelectedDate
aantal: Value (quant.Text)
)
)
Hi, thanks for your help! I copied the code and pasted it in the editor and it gives an error: unexpected signs. the formula contains ParenClose while Colon is expected.
The code:
ForAll(Gallery1.AllItems;
Patch(Uitgeleend;
Defaults(Uitgeleend);
{Title:Titel;
categorie:Categorie.Value;
barcode:Barcode;
project:Textcart.Text;
datumretour:Datepick.SelectedDate;
aantal: Value (quant.Text)
}
);
Office365Outlook.SendEmailV2(
"mymail@work.com";
"Test";
Title:Titel
categorie:Categorie.Value
barcode:Barcode
project:Textcart.Text
datumretour:Datepick.SelectedDate
aantal: Value (quant.Text)
)
)
;;Clear(MyCollection)
;;Navigate(Uitleen)
What did i wrong? Thanks!
Hi @MelvinGRM ,
Two things - firstly the Patch will work a lot faster if done as below. Also the Body of the email needs to be a Text String - I have added line breaks as well
Patch(
Uitgeleend;
ForAll(
Gallery1.AllItems;
{
Title: Titel;
categorie: Categorie.Value;
barcode: Barcode;
project: Textcart.Text;
datumretour:Datepick.SelectedDate;
aantal: Value(quant.Text)
}
)
);
ForAll(
Gallery1.AllItems;
Office365Outlook.SendEmailV2(
"mymail@work.com";
"Test";
"Title:" & Titel &
"<br>categorie:" & Categorie.Value &
"<br>barcode:" & Barcode &
"<br>project:" & Textcart.Text &
"<br>datumretour:" & Text(Datepick.SelectedDate, "dd/mm/yyyy") &
"<br>aantal:" & quant.Text & "<br>"
)
)
);;
Clear(MyCollection);;
Navigate(Uitleen)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @WarrenBelz thanks for the code and your tip for patching.
When i use your code it gives an error: invalid argument type (table) a record value is expected instead
What did i wrong?
thanks!
Hi @MelvinGRM ,
I simply used your code assuming it had valid values - my only change was the ForAll/Patch reversal (for speed) and the text structure in the body of the email. Which element is causing the error ?
Hi @WarrenBelz,
i changed the patch code back and it works. Thanks!
The code that i use:
ForAll(Gallery1.AllItems;
Patch(Uitgeleend;
Defaults(Uitgeleend);
{Title:Titel;
categorie:Categorie.Value;
barcode:Barcode;
project:Textcart.Text;
datumretour:Datepick.SelectedDate;
aantal: Value (quant.Text)
}
);;
ForAll(
Gallery1.AllItems;
Office365Outlook.SendEmailV2(
"mail@mail.com";
"Test";
"Title:" & Titel &
"<br>categorie:" & categorie.Value &
"<br>barcode:" & barcode &
"<br>project:" & Textcart.Text &
"<br>datumretour:" & Text(Datepick.SelectedDate; "dd/mm/yyyy") &
"<br>aantal:" & quant.Text & "<br>"
)
)
);;
Clear(MyCollection);;
Navigate(Uitleen)
If i patch two or more items in one gallery, i get separated emails. Is there a way to send al those information in one email?
Thanks!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
208 | |
97 | |
60 | |
51 | |
51 |
User | Count |
---|---|
255 | |
158 | |
87 | |
79 | |
59 |