Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Issue with Choice Field Value Assignment and Multiple Actions in OnSelect

(2) ShareShare
ReportReport
Posted on by 4

English Translation : 

 

Hello everyone,

I’m currently working on a visitor registration app in Power Apps connected to a SharePoint (or Dataverse) table named Visiteur, and I’m facing two issues related to the OnSelect property of a button.

 
 

⚙️ Context

 

My data source includes a Présence column (Presence), which is a Choice field with two global values: "Présent" and "Absent".

 

Here’s my current OnSelect formula:

 
Patch(
Visiteur;
Defaults(Visiteur);
{
Nom: DataCardValue9.Value;
Prénom: DataCardValue10.Value;
'Personne et/ou service visité': DataCardValue13.Value;
'Heure d''arrivée': Now();
Présence: LookUp(Choices(DataCardValue1.Items); Value = "Présent")
}
);
ResetForm(Form3);
NewForm(Form3);
Navigate('Écran de bienvenue'; ScreenTransition.Fade)
 
 

🧨 Issue 1 – Présence field doesn't accept value with LookUp(Choices(...))

 

When I try to assign "Présent" using LookUp(Choices(DataCardValue1.Items); Value = "Présent"), Power Apps throws an error:

The type of this argument does not match the expected type 'OptionSetValue'. Found: Record.

 

 

However, if I write:

 
Présence: 'Présent / Absent'.Présent
 

✅ It works perfectly.

 

So it seems that LookUp(Choices(...)) is not returning the expected format for the Patch statement.

 
 

🧨 Issue 2 – Cannot execute multiple actions in OnSelect

 

As soon as I add multiple instructions after the Patch (like ResetForm, NewForm, Navigate, Notify), the formula editor flags the ; after Patch(...) as a syntax error.

 

Patch(
Visiteur;
Defaults(Visiteur);
{
Nom: DataCardValue9.Value;
Prénom: DataCardValue10.Value;
'Personne et/ou service visité': DataCardValue13.Value;
'Heure d''arrivée': Now();
Présence: 'Présent / Absent'.Présent
}
);

ResetForm(Form3);
NewForm(Form3);
Navigate('Écran de bienvenue'; ScreenTransition.Fade)

 

Unexpected character. A semicolon was not expected at this position.

 

 

It looks like Power Apps only executes the Patch(...) and prevents any further actions, as if OnSelect is limited to a single instruction.

 
 

What I’ve tried:

 
  • I'm in French Editor

  • Wrapping the Patch result in a Set(...) variable

  • Removing LookUp() and assigning values manually

  • Verifying form and screen names

 
 

My questions:

 

How can I properly assign "Présent" to a Choice field in a Patch function without triggering a type mismatch?

Why are actions like ResetForm, NewForm, and Navigate not accepted after the Patch in OnSelect?

 

Any help would be greatly appreciated!

 
Bonjour à tous,
 

Je rencontre actuellement deux problèmes dans Power Apps en utilisant un bouton avec plusieurs instructions dans son événement OnSelect.

 
 

🎯 Contexte de l’application

 

Je crée un registre numérique de visiteurs connecté à une table Visiteur contenant notamment un champ Présence de type choix global (Présent / Absent).

 
 

📌 Problème 1 – Le champ Présence ne prend pas la valeur "Présent"

 

Dans cette instruction OnSelect :

 
Patch(
Visiteur;
Defaults(Visiteur);
{
Nom: DataCardValue9.Value;
Prénom: DataCardValue10.Value;
'Personne et/ou service visité': DataCardValue13.Value;
'Heure d''arrivée': Now();
Présence: LookUp(Choices(DataCardValue1.Items); Value = "Présent")
}
);
 

➡️ Le champ Présence retourne une erreur disant que le type ne correspond pas (Record au lieu de OptionSetValue).

 

Pourtant, lorsque j’écris directement :

 
Présence: 'Présent / Absent'.Présent
 

➡️ Cela fonctionne parfaitement.

 

Donc j’en conclus que Choices(...).Value = "..." ne fonctionne pas comme prévu dans ce contexte.

 
 

📌 Problème 2 – Impossible d’enchaîner plusieurs actions après le Patch

 

Quand je complète le OnSelect avec d'autres instructions comme :

Patch(
Visiteur;
Defaults(Visiteur);
{
Nom: DataCardValue9.Value;
Prénom: DataCardValue10.Value;
'Personne et/ou service visité': DataCardValue13.Value;
'Heure d''arrivée': Now();
Présence: 'Présent / Absent'.Présent
}
);
ResetForm(Form3);
NewForm(Form3);
Navigate('Écran de bienvenue'; ScreenTransition.Fade)
 

Power Apps m’indique une erreur :

 
 

Caractères inattendus. Le point-virgule avant ResetForm est invalide.

 

➡️ Cela donne l’impression que le bouton n’interprète qu’une seule action, et bloque dès qu’on ajoute d'autres instructions après Patch.

 
 

🔧 Ce que j’ai déjà essayé :

Vérification de la langue de l’éditeur (je suis bien en français)

Utilisation de Set(...) pour stocker le résultat du Patch

Remplacement du champ Présence par d'autres formules

Test sur formulaire attaché et champ de saisie libre

 
 

❓Ma question :

Comment assigner proprement une valeur "Présent" dans un champ de type "Choix" global (Présent / Absent) dans un Patch ?

Pourquoi les actions comme ResetForm, Notify, Navigate sont bloquées dans OnSelect après un Patch alors que la syntaxe semble correcte ?

 

 

 

Categories:
  • WarrenBelz Profile Picture
    148,344 Most Valuable Professional on at
    Issue with Choice Field Value Assignment and Multiple Actions in OnSelect
    My response was to the SharePoint scenario - for a Text field destination (I assumed you were getting the data from a Choice field) . If it was a SharePoint Choice field the syntax would be
    Présence: {Value: "Présent"}
    Dataverse Option Sets however do not work in this way - you need to access the field reference required. I am not a Dataverse expert (far from it) - this video may be useful.
  • UnsterKylink Profile Picture
    4 on at
    Issue with Choice Field Value Assignment and Multiple Actions in OnSelect
    Thanks again for your reply @WarrenBelz
     
    You're right that the desired value is "Présent", and it would seem natural to assign it as a string like this:


    Présence: "Présent"

    However, in my case, the Présence column is a Choice (OptionSet) field (using the global set 'Présent / Absent'). So when I assign a plain string, I get this error:
     
    The type of this argument 'crecd_presence' does not match the expected type 'OptionSetValue (Présent / Absent)'. Found: Text
    So unfortunately, "Présent" on its own doesn't work.
     
    he only thing that works for me is using the global option set reference like this:


    Présence: 'Présent / Absent'.Présent

    That works — the record is created successfully with "Présent" stored in the correct field.
     
    But here's the weird part:
     
    As soon as I add anything after the Patch, such as:

    ResetForm(Form3);
    NewForm(Form3);
    Navigate('Écran de bienvenue'; ScreenTransition.Fade)

    …it stops working. Power Apps gives a syntax error on the semicolon after the Patch, as if it refuses to parse additional commands.
     
    And yes — I'm using the French locale, so my separators are semicolons (;).
     
    So in summary:
     
    - 'Présent / Absent'.Présent works as an OptionSetValue
    - "Présent" (string) causes a type error
    - Any instructions after Patch(...) (even with ;) break the formula unexpectedly
     
    Thanks again for your help
  • WarrenBelz Profile Picture
    148,344 Most Valuable Professional on at
    Issue with Choice Field Value Assignment and Multiple Actions in OnSelect
    I may be missing something here, but you already know the outcome of the query - the string value "Present" - so why do the lookup ?
    Patch(
       Visiteur;
       Defaults(Visiteur);
       {
          Nom: DataCardValue9.Value;
          Prénom: DataCardValue10.Value;
          'Personne et/ou service visité': DataCardValue13.Value;
          'Heure d''arrivée': Now();
          Présence: "Présent"
       }
    );
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1