cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emfuentes27
Advocate III
Advocate III

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
Responsive Resident
Responsive Resident

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.

View solution in original post

emfuentes27
Advocate III
Advocate III

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,360)