0

I have 2 combo-boxes inside a canvas app form named Approver1 & Approver2 >> where both fields represents a SharePoint "People/Group" field

Now I want to make sure that the Approver1 will be different than Approver2.

And I need to prevent submitting the form if the 2 combo boxes have the same user/value + to show a message under each field if the 2 combo boxes have the same value?

Is this possible? and how?

4
  • Is this a standalone canvas app or customized list form? Combo boxes are single selection or multiple selection? Commented Jun 13, 2023 at 2:33
  • In order to better help you solve the problem, can you provide some more detailed description?
    – Xyza_MSFT
    Commented Jun 13, 2023 at 8:00
  • @GaneshSanap thanks for the reply.. this is a standalone cavas app + comboboxes are single selection thanks Commented Jun 13, 2023 at 10:43
  • 1
    check my answer given below Commented Jun 13, 2023 at 11:12

1 Answer 1

1

For single selection combo box controls in Power Apps, you can compare values using their properties via .Selected property.

For example:

For combo box with person or group column, you can compare values based on the selected user emails.

You can set add a label control in your app and set it's Text property to:

If(ComboBox1.Selected.Email = ComboBox2.Selected.Email, "Same", "Different")

Output:

  1. When same person selected:

    enter image description here

  2. When different person selected:

    enter image description here


You can use similar comparison for your formulas in other places.

  1. You can set Visible property of label control which shows error message to:
ComboBox1.Selected.Email = ComboBox2.Selected.Email
  1. You can use formula like below in OnSelect property button control which saves form in list:
If(
    ComboBox1.Selected.Email = ComboBox2.Selected.Email,
    Notify("Please select different Approvers.", NotificationType.Error),
    SubmitForm(Form1)
)
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.