Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Compare FullName of contact in gallery to variables whose values are an account's primary and secondary contacts

(0) ShareShare
ReportReport
Posted on by 28

Hi,

 

I'm building a Power App which passes the GUID of an account into the app as a URL parameter.  

 

One screen in the app has combo boxes which allows the running user to select the primary and secondary contacts for the account.  The changes are applied to the datasource via a button.  The OnSelect property of the button also sets two global variables as follows:

 

Set(PrimaryContact, 'ComboBox primary contact'.Selected.'Full Name')
;
Set(SecondaryContact, 'ComboBox secondary contact'.Selected.'Full Name')

 

The next screen in the app has two galleries.  One is for accounts and is filtered to show only the account whose GUID is in the URL.  The second gallery is for contacts related to the account.  The contacts gallery is filtered by the Items property 'Gallery Accounts'.SelectedContacts.

 

I created two label fields to display the primary and secondary contact variables to confirm that they passed from the previous screen to the gallery screen.  They do pass successfully to the gallery screen.

 

My contacts gallery has label field whose name is 'Gallery label full name" and whose Text property is ThisItem.'Full Name'. I have created another label field in the gallery called 'Role'.  I want to populate the field 'Role' with the result of a function which compares 'Gallery label full name' to the global variable PrimaryContact and if they don't match, to then compare 'Gallery label full name' to the global variable SecondaryContact and if there is still no match, to display "no role defined".  

 

Here is my problem.  I started with a simple IF function with a couple configurations just to see if I was on the right track but they don't work:

If(Contacts,ThisItem.'Full Name' = Text(PrimaryContact),"Primary Contact", "false")

If(Contacts,ThisItem.'Full Name' = Value(PrimaryContact),"Primary Contact", "false")

If(Contacts,ThisItem.'Full Name' = PrimaryContact,"Primary Contact", "false")

 

I keep getting the error "Invalid argument type (Table). Expecting a Boolean value instead.

 

Help, please!

 

  • CNT Profile Picture
    10,919 Super User 2025 Season 1 on at
    Re: Compare FullName of contact in gallery to variables whose values are an account's primary and secondary contacts

    @SRW04027 

    Glad it help!

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • SR04027 Profile Picture
    28 on at
    Re: Compare FullName of contact in gallery to variables whose values are an account's primary and secondary contacts

    Hi CNT,

     

    Thank you, that worked!

  • Verified answer
    CNT Profile Picture
    10,919 Super User 2025 Season 1 on at
    Re: Compare FullName of contact in gallery to variables whose values are an account's primary and secondary contacts

    @SRW04027 

    Please try the following,

    Set the Text property of the Label to,

    Switch(ThisItem.'Full Name',
    	PrimaryContact, "Primary Contact",
    	SecondaryContact, "Secondary Contact",
    	"No role defined"
    )

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard