cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emfuentes27
Resolver II
Resolver II

Determine if Person Field is empty

I created a form Edit/New that has two People Fields. The first one is Primary Reviewer and the other is Secondary Reviewer. I set the value of the primary reviewer by adding the current user information, and it works perfectly:

 

 

If(New_Form.Mode = FormMode.New, { 
        DisplayName: myself.FullName,
        Claims: "i:0#.f|membership|" & myself.Email
    },
    Parent.Default)

 

 

The other field will remain empty if the FormMode = New. That is because the Secondary Reviewer will always open the form in Edit Mode. Now what I need is that when the user open the form in Edit Mode it needs to check if the Secondary Reviewer field is empty, and if the form is in Edit Mode. This is what I've done so far, but is not working, as the field remains empty:

 

 

If(
    New_Form.Mode = FormMode.Edit && IsEmpty(DataCardValue22),
    {
        DisplayName: myself.FullName,
        Claims: "i:0#.f|membership|" & myself.Email
    },
    Parent.Default
)

 

 What am I missing here?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
GarethPrisk
Resident Rockstar
Resident Rockstar

Try setting the DefaultSelectedItems property of your "Secondary Reviewer" datacard to:

If(
    And(
        FormName.Mode = FormMode.Edit,
        IsBlank(Parent.Default)
    ),
    PrimaryReviewer_DataCardName.Default,
    Parent.Default
)

This will consider if your Form is in edit mode, and if the data card has a value. If it doesn't, it will use the value from the other data card, or its current value.

View solution in original post

3 REPLIES 3
Ashwin7104
Super User
Super User

Hey @emfuentes27 - I think a property cannot reference itself. Please use global variable to identify if people picker is blank or not in Screen visible and use the flag in default property of the control.

 

// Screen Visible
Set(SecondaryReviewerFlag, IsBlank(DataCardValue22))
If(
    New_Form.Mode = FormMode.Edit && SecondaryReviewerFlag,
    {
        DisplayName: myself.FullName,
        Claims: "i:0#.f|membership|" & myself.Email
    },
    Parent.Default
)
GarethPrisk
Resident Rockstar
Resident Rockstar

Try setting the DefaultSelectedItems property of your "Secondary Reviewer" datacard to:

If(
    And(
        FormName.Mode = FormMode.Edit,
        IsBlank(Parent.Default)
    ),
    PrimaryReviewer_DataCardName.Default,
    Parent.Default
)

This will consider if your Form is in edit mode, and if the data card has a value. If it doesn't, it will use the value from the other data card, or its current value.

emfuentes27
Resolver II
Resolver II

Great suggestion @GarethPrisk ! Right before your suggestion I tried:

IsBlank(ThisItem.'Secondary Reviewer')

Instead of what you suggested:

IsBlank(Parent.Default)

 I kind of like your suggestion better. Thanks so much.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,172)