Sending an email from a Model Driven App on a command bar button
Leverage the Command Bar with PowerFX to use the Mailto function
The command bar is the ribbon on top of your Powerapp.
- Go into edit mode for your Model Driven App
- Right click on your table, Edit the Command Bar
- This opens the Command bar editor
- Main Form - This is the one I’m focusing on right now
- Main Grid
- Subgrid View
- Associated View
Scott Durow created this and it has been adopted by Microsoft ever since. If you need any information on all of the functionality, he has awesome video’s and sessions on it.
I have a business case, where I want to get information from my Model driven app form, open an email thats pre-populated so I can use an add-in we only have in the Outlook client.
- Open up the command bar editor.
- Click on New Command
- On the Onselect, you can type your PowerFX code
Use the following PowerFX code:
Launch("mailto:" & "youremailadress" & "?subject=" & "" & Self.Selected.Item.'whateveryouwant' & " : " & Self.Selected.Item.'whateveryouwant' & "&body=" & "put your body text here" & " body text " & Self.Selected.Item.'whateveryouwant' `)`
for line breaks.
Char(13) wont work.
If you want to add a cc, do the following:
After the email adres, directly put
Publish and Save, Play, and test your code!