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.
Solved! Go to Solution.
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.
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
)
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.
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.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
193 | |
70 | |
49 | |
48 | |
20 |
User | Count |
---|---|
249 | |
127 | |
84 | |
76 | |
74 |