Skip to main content

Notifications

Community site session details

Community site session details

Session Id : VtXiMcwyWC93iAt7kFir02
Power Apps - Building Power Apps
Unanswered

Required fields require user to fill a different field

Like (0) ShareShare
ReportReport
Posted on 30 Aug 2023 15:27:13 by

Hello everyone! This is the code:

If(
 'Review Purpose'.Selected.Value="Review purpose", Notify("Select the Review Purpose."), 
 'Project Site Box'.Text="", Notify("Input the Project Site."), 
 InputDrawing.Text="", Notify("Input the Drawing Numbers."),
 'Project Number'.Text="", Notify("Input the Project Number."),
 !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="")), Notify("Enter an answer for all questions."),
 !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="Passed with comments")), Notify("Enter comment on answers Passed with comments."),
 !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="Not Passed")), Notify("Enter comment on answers Not passed."),
 Set(LabelVisible,true); 

ForAll('OneLine Gal'.AllItems, Patch('Power App Data Store', Defaults('Power App Data Store'), //The for all selects all the items in the gallery, the patch function is to upload the fiels to their columns
{
'Unique ID':'Project Number'.Text & "-" & InputDrawing.Text & "-" & DocTitleBox.Text, 
Title:Label3.Text, 
'Project Site':'Project Site Box'.Text,
'Project Number':'Project Number'.Text,
'Drawing#':InputDrawing.Text,
'Review Purpose': 'Review Purpose'.Selected.Value,
'Document Title':DocTitleBox.Text,
'Document Number':DocNumberBox.Text,
Department:DepartmentBox.Text,
'Question Number':'Question Numbers'.Text,
'Checklist Questions':'Checklist Questions'.Text,
Answers:Answers.Selected.Value,
Comments:Comments.Text,
'Additional Comments':'Additional Comments'.Text,
Score: If(Answers.Selected.Value="Passed","3",Answers.Selected.Value="Passed with comments","1",Answers.Selected.Value="Not passed","0",Answers.Selected.Value="N/A","")
}
 
));
Office365Outlook.SendEmailV2(
 User().Email,
 "One Line Checklist", //Subject of the email
 "PDF Generated by Power App", //Content of the email 
 {
 Attachments: Table(
 {
 Name: "OneLineCheck.pdf", //Name of the pdf generated
 ContentBytes: PDF( //Calls the pdf Function
 'Container 1', 
 {ExpandContainers: true} 
 )
 }
 )
 }
);
 Set(ProcessCompleted,true); 
 Set(LabelVisible,false)
) 

 

For when they pick Not passed or Passed with comments on the dropdown, I want them to fill the comment box next to the question, so the notification shouldn't appear if they filled the comment box next to the question with anything other than blank, hopefully someone can help me on this, thank you!

Categories:
  • Angel5 Profile Picture
    on 30 Aug 2023 at 15:53:36
    Re: Required fields require user to fill a different field

    This worked partially, when they choose "Not Passed" or "Passed with comments" the submit button doesn't do anything if the comment box is also empty, it does submit when they fill the comment box, however I want the app to notify them to fill the comment box, otherwise they're going to hit submit and nothing will happen and they might get confused on why nothing occured.

  • AndrewR1 Profile Picture
    1,572 Super User 2025 Season 1 on 30 Aug 2023 at 15:32:05
    Re: Required fields require user to fill a different field

    To achieve this, you can update your existing code to include additional conditions before showing notifications. Here's a modified version of your code:

    If(
     'Review Purpose'.Selected.Value = "Review purpose", Notify("Select the Review Purpose."),
     IsBlank('Project Site Box'.Text), Notify("Input the Project Site."),
     IsBlank(InputDrawing.Text), Notify("Input the Drawing Numbers."),
     IsBlank('Project Number'.Text), Notify("Input the Project Number."),
     !IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value = "")), Notify("Enter an answer for all questions."),
     IsEmpty(
     Filter('OneLine Gal'.AllItems, 
     (Answers.Selected.Value = "Passed with comments" || Answers.Selected.Value = "Not Passed") && IsBlank(Comments.Text)
     )
     ),
     Set(LabelVisible, true);
     
     // Rest of your code
    )

     

    In this version of your code, the condition IsEmpty(...) checks whether the user selected "Passed with comments" or "Not Passed" and if the corresponding comment box (in this case, the Comments field) is blank. If the comment box is not blank, the condition will evaluate as false, and the notification won't be triggered.

    This way, the notification will only appear if the user selects "Not Passed" or "Passed with comments" and leaves the corresponding comment box empty. If they enter comments, the notification will be skipped. Make sure you adapt this logic according to your field names and requirements.

     

    If this helped and resolves your issue can you leave a thumbs up and mark this as the solution? 

     

    Many Thanks 

    Andrew

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started