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 / How submit button will...
Power Apps
Unanswered

How submit button will validate if the attachment datacard is empty or missing 1 attachment based on category

(1) ShareShare
ReportReport
Posted on by 14

Hi, I'm a newcomer to PowerApps and I'm currently working on a project. My managers have requested a feature to check if attachments are correctly uploaded by users, based on the screenshot below. How can I configure the submit button to validate the attachment data card, ensuring no attachment is missing based on the Attachment Category on the left side of my form?

 

In addition to the code shown in my screenshot, I have also tried the following code, but it is not working.

// Function to check if all attachments have valid tags
/*If(
    // Check if the number of attachments without valid tags is 0
    CountIf(
        DataCardValue77.Attachments,
        !(First(Split(DisplayName, "-")).Result in ["BIR", "DTI", "AFS", "Non Vat"])
    ) = 0 && CountRows(DataCardValue77.Attachments) > 0, // Ensure there is at least one attachment
    SubmitForm(FrmCreditLineRequest), // Submit the form if all attachments have valid tags
    Notify("Please attach files with valid tags (BIR, DTI, AFS, Non Vat).", NotificationType.Error) // Notify if there are invalid tags
)*/

/*If(CountIf
        (ColAttachments, !
            (First
                (Split(DisplayName, "-")
                ).Value in ColAttachTags = ["BIR", "DTI", "AFS", "Non Vat"]
            )
        )=0, SubmitForm(FrmCreditLineRequest),
        Notify("Please attach files with valid tags (BIR, DTI, AFS, Non Vat).")
    )*/

 

Screenshot 2024-07-15 122159.png

Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @kcpelobello ,

    To validate attachments before submitting the form in PowerApps, you can utilize the CountIf function to ensure that each attachment has a valid tag and there are no missing attachments.

    First, create a collection to hold the valid attachment tags. You can do this in the OnStart property of the app or in the OnVisible property of the screen.

     

    ClearCollect(ColAttachTags, ["BIR", "DTI", "AFS", "Non Vat"]);

     

    In the OnSelect property of the submit button, you will check if each attachment's tag (extracted from the attachment's DisplayName) is valid.

     

    If(
     // Ensure that all attachments have valid tags
     CountIf(
     DataCardValue77.Attachments,
     !(
     First(Split(DisplayName, "-")).Result in ColAttachTags
     )
     ) = 0 && CountRows(DataCardValue77.Attachments) > 0, 
     // If all tags are valid and there's at least one attachment, submit the form
     SubmitForm(FrmCreditLineRequest), 
     // Otherwise, notify the user about the invalid attachment tags
     Notify("Please attach files with valid tags (BIR, DTI, AFS, Non Vat).", NotificationType.Error)
    )

     

     

  • kcpelobello Profile Picture
    14 on at

    Hi @anandm08,

     

    I appreciate your time. I will give this a try.

     

    Thank you.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard