web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Function Collect not w...
Power Apps
Answered

Function Collect not working the way I want

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hey guys,

How're you doing? I hope you're all fine.

 

I've got a problem I thought I might be able to solve on my own but to be honest it's more difficult than I thought it is.

 

As you can see below, the last column name AddRemove is not working the way I want. It's being highlighted and shows an error.

AddRemove is the Data Type "Two Options" in CDS but how to initialize it?

Collect(
 CommonDataService,
 {
 Amount: Value(TextInput1.Text),
 Mail: ComboBox1.Selected.UserPrincipalName, 
 AddRemove: true
 }
)

Following error messages appear:

- The function 'Collect' has some invalid arguments.

- Incompatible type. The 'AddRemove' column in the data source you're updating expects a 'OptionSetValue' type and you're using a 'Boolean' type.

 

How to correct it? I really don't know.

 

Really appreciate your support. Thanks so much!

Categories:
  • Verified answer
    eka24 Profile Picture
    20,925 on at

    Try;

    Collect( CommonDataService,
    { Amount: Value(TextInput1.Text), Mail: ComboBox1.Selected.UserPrincipalName, AddRemove: 'AddRemove(CommonDataService)'. true } )

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks so much for helping! It's been exactly the solution I was looking for...

     

    A minor flaw on your part:

    'AddRemove(CommonDataService)'.Yes

     

    Have a nice one 😉.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard