web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If Field Blank don't i...
Power Apps
Answered

If Field Blank don't include in email

(0) ShareShare
ReportReport
Posted on by 86

Hi,

 

I currently have an app to submit purchase requests.

 

Capture.JPG

 

The onselect of the submit button is as follows:

Navigate(PRSuccess, ScreenTransition.Fade);

ClearCollect(collectAttachments, PRattachmentcard.Attachments);

Office365Outlook.SendEmailV2(
"myemail",
"Purchase Order",
"Item 1: " & item1input & "<br/>" & "Item 2: " & item2input & "<br/>" & "Item 3: " & item3input & "<br/>" & "Item 4: " & item4input & "<br/>" & "Item 5: " & item5input & "<br/>" & "Item 6: " & item6input & "<br/>" & "Item 7: " & item7input & "<br/>" & "Item 8: " & item8input & "<br/>" & "Item 9: " & item9input & "<br/>" & "Item 10: " & item10input,

{Attachments: AddColumns(
RenameColumns(
PRattachmentcard.Attachments,
"Value",
"ContentBytes"
),
"@odata.type",
""
)
}
)

 

When I receive the email in my inbox, it displays all ten fields even if some are blank. 

sgiorgio_2-1691700351530.png

 

How do I make it that the fields that have no input for don't show up in the email?

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    Hi @sgiorgio ,

    Try this

    Office365Outlook.SendEmailV2(
     "myemail",
     "Purchase Order",
     "Item 1: " & item1input & "<br/>" & 
     If(
     Len(item2input) > 0,
     "Item 2: " & item2input & "<br/>"
     ) & 
     If(
     Len(item3input) > 0,
     "Item 3: " & item3input & "<br/>"
     ) & 
     If(
     Len(item4input) > 0,
     "Item 4: " & item4input & "<br/>"
     ) & 
     If(
     Len(item5input) > 0,
     "Item 5: " & item5input & "<br/>"
     ) & 
     If(
     Len(item6input) > 0,
     "Item 6: " & item6input & "<br/>"
     ) & 
     If(
     Len(item7input) > 0,
     "Item 7: " & item7input & "<br/>"
     ) & 
     If(
     Len(item8input) > 0,
     "Item 8: " & item8input & "<br/>"
     ) & 
     If(
     Len(item9input) > 0,
     "Item 9: " & item9input & "<br/>"
     ) & 
     If(
     Len(item10input) > 0,
     "Item 10: " & item10input
     ),
     {
     Attachments: 
     AddColumns(
     RenameColumns(
     PRattachmentcard.Attachments,
     "Value",
     "ContentBytes"
     ),
     "@odata.type",
     ""
     )
     }
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • rpersad Profile Picture
    831 on at

    create a blank text variable,

    Set('variable name', Blank())

    And by using If statements and the Concatenate function you can check if the field is blank.

    If(!IsBlank(item1input), Concatenate('variable name', "Item 1: " & item1input & "<br/>"));
    If(!IsBlank(item2input), Concatenate('variable name', "Item 2: " & item2input & "<br/>"));


    Basically you would be using the if statements to check if the field is not blank. If true, add the information to a string variable. Just create if statements to check each input field. And then replace the body of the SendEmail with the string variable.

     

    Note: There is a new version SendEmailV3 which I would recommend you using.

  • sgiorgio Profile Picture
    86 on at

    Thank you @WarrenBelz it worked!

  • sgiorgio Profile Picture
    86 on at

    Thank you @rpersad!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard