cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

The function 'Patch' has some invalid arguements - OnSelect Patch(

Hello,

 

I'm having some issues with my OnSelect patch statement - this is patching data from PowerApps fields to a SharePoint list (not using the SharePoint edit/view form). 


The problem seems to lie in the closing bracket and colon after the curly close bracket below - when I remove these, the only bit in Red is the opening Patch( 

redlines.png

If anyone could help that would be awesome!!

Full patch statement below:

 

 

 

/* THIS IS THE START OF THE PATCH FUNCTION THAT WILL PATCH DATA TO ASSOCIATED SHAREPOINT LIST COLUMNS */
Patch(
'Uniform order form', 
Defaults('Uniform order form'),
{
	Title: User().FullName,
    AddressLine1: AddressLine1.Text,
    AddressLine2: AddressLine2.Text,
    Beanie: Beanie_dd.Selected,
    BeanieQty: BeanieQty.Text,
    BumpHat: BumpHat_dd.Selected,
    BumpHatQty: BumpHatQty.Text,
    City: CityTown.Text,
    FemaleClanJanSize: FemaleCleanJanSize_dd.Selected, 
    FemaleCleanJanLL: FemaleCleanJanLL_dd.Selected,
    FemaleCleanJanQty: FemaleCleanJanQty.Text,
    FemaleClanJanWaist: FemaleCleanJanWaist_dd.Selected,
    FemaleMascotShortsSize: FemaleMascotShortsSize_dd.Selected,
    FemaleMascotShortsQty: FemaleMascotShortsQty.Text,
    FemaleOxfordWhiteShirtBust: FemaleOxfordWhiteShirtBust_dd.Selected,
    FemaleOxfordWhiteShirtQty: FemaleOxfordWhiteShirt_Qty.Text,
    FemaleOxfordWhiteShirtSize: FemaleOxfordWhiteShirtSize_dd.Selected,
    GloveSize: GloveSize.Text,
    GlovesQty: GlovesQty.Text,
    HiVisJacket: HiVisJacket_dd.Selected,
    HiVisJacketQty: HiVisJacketQty.Text,
    HiVisWaistcoat: HiVisWaistcoat_dd.Selected,
    HiVisWaistcoatQty: HiVisWaistcoatQty.Text,
    LadiesFleece: LadiesFleece_dd.Selected,
    LadiesFleeceQty: FemaleFleeceQty.Text,
    LadiesHolsterPocketTrousersLL: LadiesHolsterTrousersLL_dd.Selected,
    LadiesHolsterPocketTrousersQty: LadiesHolsterTrousersQty.Text,
    LadiesHolsterPocketTrousersSize: LadiesHolsterTrousersSize_dd.Selected,
    LadiesHolsterPocketTrousersWaist: LadiesHolsterTrousersWaist_dd.Selected,
    LadiesOfficeTrousersLegLength: LadiesOfficeTrousersLL_dd.Selected,
    LadiesOfficeTrousersQty: LadiesOfficeTrousersQty.Text,
    LadiesOfficeTrousersSize: LadiesOfficeTrousersSize_dd.Selected,
    LadiesOfficeTrousersWaist: LadiesOfficeTrousersWaist_dd.Selected,
    LadiesPoloShirt: LadiesPoloShirt_dd.Selected,
    LadiesPoloShirtQty: LadiesPoloShirtQty.Text,
    MaleBerteeShortsQty: MaleBerteeShortsQty.Text,
    MaleBerteeShortsWaist: MaleBerteeShortsWaist_dd.Selected,
    MaleBlackOfficeTrousers: MaleBlackOfficeTrousersWaist_dd.Selected,
    MaleBlackOfficeTrousersLL: MaleBlackOfficeTrousersLL_dd.Selected,
    MaleBlackOfficeTrousersQty: MaleBlackOfficeTrousersQty.Text,
    MaleCleanJan: MaleCleanJanWaist_dd.Selected,
    MaleCleanJanLL: MaleCleanJanLL_dd.Selected,
    MaleCleanJanQty: MaleCleanJanQty.Text,
    MaleOxfordWhiteShirtChest: MaleOxfordWhiteShirtChest_dd.Selected,
    MaleOxfordWhiteShirtNeck: MaleOxfordWhiteShirtNeck_dd.Selected,
    MaleOxfordWhiteShirtQty: MaleOxfordWhiteShirt_Qty.Text,
    MensFleece: MensFleece_dd.Selected,
    MensFleeceQty: MensFleeceQty.Text,
    MensHolsterPocketTrousersLL: MensHolsterTrousersLL_dd.Selected,
    MensHolsterPocketTrousersQty: MensHolsterTrousersQty.Text,
    MensHolsterTrousersWaist: MensHolsterTrousersWaist_dd.Selected,
    MensPoloShirt: MensPoloShirt_dd.Selected,
    MensPoloShirtQty: MensPoloShirtQty.Text,
    PPEPack: PPEPack_tgl.Value,
    PPEPackQty: PPEPackQty.Text,
    Postcode: Postcode.Text,
    ShoeBootName: ShoeBootName_dd.Selected,
    ShoeBootSize: ShoeBootSize_dd.Selected,
    SoftShellUnisex: SoftShellUnisex_dd.Selected,
    SoftshellUnisexQty: SoftShellUnisexQty.Text,
    SupMan: SupManPicker.Selected,
    UnisexShortsBlack: UnisexShortsBlackWaist_dd.Selected,
    UnisexShortsBlackQty: UnisexShortsBlackQty.Text,
    UnisexSweatshirt: UnisexSweatshirt_dd.Selected,
    UnisexSweatshirtQty: UnisexSweatshirtQty.Text,
    UnisexLightweightTradesHolsterTrouserLL: UnisexTradesHolsterLL_dd.Selected,
    UnisexTradesHolsterQty: UnisexTradesHolsterQty.Text,
    UnisexTradesHolsterWaist: UnisexTradesHolsterWaist_dd.Selected,
    UnisexWaterJackQty: UnisexWaterproofQty.Text,
    UnisexWaterproofJacket: UnisexWaterproofJacket_dd.Selected,
    WhiteHardHat: WhiteHardHat_dd.Selected,
    WhiteHardHatQty: HardHatQty.Text,


    SupMan: {
		Claims: "i:0#.f|membership|" & SupManPicker.Selected.Mail,
		Department: SupManPicker.Selected.Department,
		DisplayName: SupManPicker.Selected.DisplayName,
		Email: SupManPicker.Selected.Mail,
		JobTitle:"",
		Picture:""
    }
);
/* THIS WILL RESET ALL FIELDS WHEN THE FORM HAS BEEN SUBMITTED */

Reset(AddressLine1);Reset(AddressLine2);Reset(Beanie_dd);Reset(BeanieQty);Reset(BumpHat_dd);Reset(BumpHatQty);Reset(CityTown);Reset(FemaleCleanJanSize_dd);Reset(FemaleCleanJanLL_dd);Reset(FemaleCleanJanQty);Reset(FemaleCleanJanWaist_dd);Reset(FemaleMascotShortsSize_dd);Reset(FemaleMascotShortsQty);Reset(FemaleOxfordWhiteShirtBust_dd);Reset(FemaleOxfordWhiteShirt_Qty);Reset(FemaleOxfordWhiteShirtSize_dd);Reset(GloveSize);Reset(GlovesQty);Reset(HiVisJacket_dd);Reset(HiVisJacketQty);Reset(HiVisWaistcoat_dd);Reset(HiVisWaistcoatQty);Reset(LadiesFleece_dd);Reset(FemaleFleeceQty);Reset(LadiesHolsterTrousersLL_dd);Reset(LadiesHolsterTrousersQty);Reset(LadiesHolsterTrousersSize_dd);Reset(LadiesHolsterTrousersWaist_dd);Reset(LadiesOfficeTrousersLL_dd);Reset(LadiesOfficeTrousersQty);Reset(LadiesOfficeTrousersSize_dd);Reset(LadiesOfficeTrousersWaist_dd);Reset(LadiesPoloShirt_dd);Reset(LadiesPoloShirtQty);Reset(MaleBerteeShortsQty);Reset(MaleBerteeShortsWaist_dd);Reset(MaleBlackOfficeTrousersWaist_dd);Reset(MaleBlackOfficeTrousersLL_dd);Reset(MaleBlackOfficeTrousersQty);Reset(MaleCleanJanWaist_dd);Reset(MaleCleanJanLL_dd);Reset(MaleCleanJanQty);Reset(MaleOxfordWhiteShirtChest_dd);Reset(MaleOxfordWhiteShirtNeck_dd);Reset(MaleOxfordWhiteShirt_Qty);Reset(MensFleece_dd);Reset(MensFleeceQty);Reset(MensHolsterTrousersLL_dd);Reset(MensHolsterTrousersQty);Reset(MensHolsterTrousersWaist_dd);Reset(MensPoloShirt_dd);Reset(MensPoloShirtQty);Reset(PPEPack_tgl);Reset(PPEPackQty);Reset(Postcode);Reset(ShoeBootName_dd);Reset(ShoeBootSize_dd);Reset(SoftShellUnisex_dd);Reset(SoftShellUnisexQty);Reset(SupManPicker);Reset(UnisexShortsBlackWaist_dd);Reset(UnisexShortsBlackQty);Reset(UnisexSweatshirt_dd);Reset(UnisexSweatshirtQty);Reset(UnisexTradesHolsterLL_dd);Reset(UnisexTradesHolsterQty);Reset(UnisexTradesHolsterWaist_dd);Reset(UnisexWaterproofQty);Reset(UnisexWaterproofJacket_dd);Reset(WhiteHardHat_dd);Reset(HardHatQty);


/* THIS WILL NAVIGATE THE USER TO THE SUCCESS SCREEN */
Navigate(Success_Scrn,Fade)

 

 

 

57 REPLIES 57
TylerPA
Resolver II
Resolver II

Can you try this code? Think you were missing the 2nd bracket after supman

 

/* THIS IS THE START OF THE PATCH FUNCTION THAT WILL PATCH DATA TO ASSOCIATED SHAREPOINT LIST COLUMNS */
Patch(
'Uniform order form', 
Defaults('Uniform order form'),
{
	Title: User().FullName,
    AddressLine1: AddressLine1.Text,
    AddressLine2: AddressLine2.Text,
    Beanie: Beanie_dd.Selected,
    BeanieQty: BeanieQty.Text,
    BumpHat: BumpHat_dd.Selected,
    BumpHatQty: BumpHatQty.Text,
    City: CityTown.Text,
    FemaleClanJanSize: FemaleCleanJanSize_dd.Selected, 
    FemaleCleanJanLL: FemaleCleanJanLL_dd.Selected,
    FemaleCleanJanQty: FemaleCleanJanQty.Text,
    FemaleClanJanWaist: FemaleCleanJanWaist_dd.Selected,
    FemaleMascotShortsSize: FemaleMascotShortsSize_dd.Selected,
    FemaleMascotShortsQty: FemaleMascotShortsQty.Text,
    FemaleOxfordWhiteShirtBust: FemaleOxfordWhiteShirtBust_dd.Selected,
    FemaleOxfordWhiteShirtQty: FemaleOxfordWhiteShirt_Qty.Text,
    FemaleOxfordWhiteShirtSize: FemaleOxfordWhiteShirtSize_dd.Selected,
    GloveSize: GloveSize.Text,
    GlovesQty: GlovesQty.Text,
    HiVisJacket: HiVisJacket_dd.Selected,
    HiVisJacketQty: HiVisJacketQty.Text,
    HiVisWaistcoat: HiVisWaistcoat_dd.Selected,
    HiVisWaistcoatQty: HiVisWaistcoatQty.Text,
    LadiesFleece: LadiesFleece_dd.Selected,
    LadiesFleeceQty: FemaleFleeceQty.Text,
    LadiesHolsterPocketTrousersLL: LadiesHolsterTrousersLL_dd.Selected,
    LadiesHolsterPocketTrousersQty: LadiesHolsterTrousersQty.Text,
    LadiesHolsterPocketTrousersSize: LadiesHolsterTrousersSize_dd.Selected,
    LadiesHolsterPocketTrousersWaist: LadiesHolsterTrousersWaist_dd.Selected,
    LadiesOfficeTrousersLegLength: LadiesOfficeTrousersLL_dd.Selected,
    LadiesOfficeTrousersQty: LadiesOfficeTrousersQty.Text,
    LadiesOfficeTrousersSize: LadiesOfficeTrousersSize_dd.Selected,
    LadiesOfficeTrousersWaist: LadiesOfficeTrousersWaist_dd.Selected,
    LadiesPoloShirt: LadiesPoloShirt_dd.Selected,
    LadiesPoloShirtQty: LadiesPoloShirtQty.Text,
    MaleBerteeShortsQty: MaleBerteeShortsQty.Text,
    MaleBerteeShortsWaist: MaleBerteeShortsWaist_dd.Selected,
    MaleBlackOfficeTrousers: MaleBlackOfficeTrousersWaist_dd.Selected,
    MaleBlackOfficeTrousersLL: MaleBlackOfficeTrousersLL_dd.Selected,
    MaleBlackOfficeTrousersQty: MaleBlackOfficeTrousersQty.Text,
    MaleCleanJan: MaleCleanJanWaist_dd.Selected,
    MaleCleanJanLL: MaleCleanJanLL_dd.Selected,
    MaleCleanJanQty: MaleCleanJanQty.Text,
    MaleOxfordWhiteShirtChest: MaleOxfordWhiteShirtChest_dd.Selected,
    MaleOxfordWhiteShirtNeck: MaleOxfordWhiteShirtNeck_dd.Selected,
    MaleOxfordWhiteShirtQty: MaleOxfordWhiteShirt_Qty.Text,
    MensFleece: MensFleece_dd.Selected,
    MensFleeceQty: MensFleeceQty.Text,
    MensHolsterPocketTrousersLL: MensHolsterTrousersLL_dd.Selected,
    MensHolsterPocketTrousersQty: MensHolsterTrousersQty.Text,
    MensHolsterTrousersWaist: MensHolsterTrousersWaist_dd.Selected,
    MensPoloShirt: MensPoloShirt_dd.Selected,
    MensPoloShirtQty: MensPoloShirtQty.Text,
    PPEPack: PPEPack_tgl.Value,
    PPEPackQty: PPEPackQty.Text,
    Postcode: Postcode.Text,
    ShoeBootName: ShoeBootName_dd.Selected,
    ShoeBootSize: ShoeBootSize_dd.Selected,
    SoftShellUnisex: SoftShellUnisex_dd.Selected,
    SoftshellUnisexQty: SoftShellUnisexQty.Text,
    SupMan: SupManPicker.Selected,
    UnisexShortsBlack: UnisexShortsBlackWaist_dd.Selected,
    UnisexShortsBlackQty: UnisexShortsBlackQty.Text,
    UnisexSweatshirt: UnisexSweatshirt_dd.Selected,
    UnisexSweatshirtQty: UnisexSweatshirtQty.Text,
    UnisexLightweightTradesHolsterTrouserLL: UnisexTradesHolsterLL_dd.Selected,
    UnisexTradesHolsterQty: UnisexTradesHolsterQty.Text,
    UnisexTradesHolsterWaist: UnisexTradesHolsterWaist_dd.Selected,
    UnisexWaterJackQty: UnisexWaterproofQty.Text,
    UnisexWaterproofJacket: UnisexWaterproofJacket_dd.Selected,
    WhiteHardHat: WhiteHardHat_dd.Selected,
    WhiteHardHatQty: HardHatQty.Text,


    SupMan: {
		Claims: "i:0#.f|membership|" & SupManPicker.Selected.Mail,
		Department: SupManPicker.Selected.Department,
		DisplayName: SupManPicker.Selected.DisplayName,
		Email: SupManPicker.Selected.Mail,
		JobTitle:"",
		Picture:""
    }
}
);
/* THIS WILL RESET ALL FIELDS WHEN THE FORM HAS BEEN SUBMITTED */

Reset(AddressLine1);Reset(AddressLine2);Reset(Beanie_dd);Reset(BeanieQty);Reset(BumpHat_dd);Reset(BumpHatQty);Reset(CityTown);Reset(FemaleCleanJanSize_dd);Reset(FemaleCleanJanLL_dd);Reset(FemaleCleanJanQty);Reset(FemaleCleanJanWaist_dd);Reset(FemaleMascotShortsSize_dd);Reset(FemaleMascotShortsQty);Reset(FemaleOxfordWhiteShirtBust_dd);Reset(FemaleOxfordWhiteShirt_Qty);Reset(FemaleOxfordWhiteShirtSize_dd);Reset(GloveSize);Reset(GlovesQty);Reset(HiVisJacket_dd);Reset(HiVisJacketQty);Reset(HiVisWaistcoat_dd);Reset(HiVisWaistcoatQty);Reset(LadiesFleece_dd);Reset(FemaleFleeceQty);Reset(LadiesHolsterTrousersLL_dd);Reset(LadiesHolsterTrousersQty);Reset(LadiesHolsterTrousersSize_dd);Reset(LadiesHolsterTrousersWaist_dd);Reset(LadiesOfficeTrousersLL_dd);Reset(LadiesOfficeTrousersQty);Reset(LadiesOfficeTrousersSize_dd);Reset(LadiesOfficeTrousersWaist_dd);Reset(LadiesPoloShirt_dd);Reset(LadiesPoloShirtQty);Reset(MaleBerteeShortsQty);Reset(MaleBerteeShortsWaist_dd);Reset(MaleBlackOfficeTrousersWaist_dd);Reset(MaleBlackOfficeTrousersLL_dd);Reset(MaleBlackOfficeTrousersQty);Reset(MaleCleanJanWaist_dd);Reset(MaleCleanJanLL_dd);Reset(MaleCleanJanQty);Reset(MaleOxfordWhiteShirtChest_dd);Reset(MaleOxfordWhiteShirtNeck_dd);Reset(MaleOxfordWhiteShirt_Qty);Reset(MensFleece_dd);Reset(MensFleeceQty);Reset(MensHolsterTrousersLL_dd);Reset(MensHolsterTrousersQty);Reset(MensHolsterTrousersWaist_dd);Reset(MensPoloShirt_dd);Reset(MensPoloShirtQty);Reset(PPEPack_tgl);Reset(PPEPackQty);Reset(Postcode);Reset(ShoeBootName_dd);Reset(ShoeBootSize_dd);Reset(SoftShellUnisex_dd);Reset(SoftShellUnisexQty);Reset(SupManPicker);Reset(UnisexShortsBlackWaist_dd);Reset(UnisexShortsBlackQty);Reset(UnisexSweatshirt_dd);Reset(UnisexSweatshirtQty);Reset(UnisexTradesHolsterLL_dd);Reset(UnisexTradesHolsterQty);Reset(UnisexTradesHolsterWaist_dd);Reset(UnisexWaterproofQty);Reset(UnisexWaterproofJacket_dd);Reset(WhiteHardHat_dd);Reset(HardHatQty);


/* THIS WILL NAVIGATE THE USER TO THE SUCCESS SCREEN */
Navigate(Success_Scrn,Fade)

@TylerPA 

 

Hey Tyler, 

 

Thanks for the suggestion however that didn't help - here's a visual of what's going on: 

sudosaurus_0-1668691542560.png

sudosaurus_1-1668691636368.png

sudosaurus_3-1668691711225.png

sudosaurus_4-1668691741187.png

 

 

 

 

 

TylerPA
Resolver II
Resolver II

Ok, thanks for checking - if you don't mind, what's the specific error message?

sudosaurus
Post Prodigy
Post Prodigy

@TylerPA 

 

These are the ones showing:

sudosaurus_1-1668692559670.png

I did notice that SupMan was in the main patch list as well as the SupMan claims bit so took it out of the list above and now that error has gone leaving just the 3 above. 

 

 

TylerPA
Resolver II
Resolver II

from the list settings, can you show the expected column types? Wondering if there are any lookup fields / required values. Just looking around, feel like that's in range of this:

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-gt-Invalid-argument-type-Expecting-a-r...

sudosaurus
Post Prodigy
Post Prodigy

@TylerPA 

 

I am using a mix of Choice, Single line of text and Person or Group for the SupMan column.

 

There are no lookup columns in play. 

 

Sorry - same with the other columns?

sudosaurus
Post Prodigy
Post Prodigy

@TylerPA 

 

I've attached a file to my original post which shows all the columns in use and their types. 

sudosaurus
Post Prodigy
Post Prodigy

@TylerPA 


I've just removed a bunch of code from the expression to make it easier to narrow down the issue. 

The main issues seem to be where I've marked them in red.

 

sudosaurus_1-1668702678461.png

Here's the stripped expression:

/* THIS IS THE START OF THE PATCH FUNCTION THAT WILL PATCH DATA TO ASSOCIATED SHAREPOINT LIST COLUMNS */
Patch(
'Uniform order form', 
Defaults('Uniform order form'),
{
	Title: User().FullName,
    AddressLine1: AddressLine1.Text,

/* THIS WILL RESET ALL FIELDS WHEN THE FORM HAS BEEN SUBMITTED */

Reset(AddressLine1);Reset(AddressLine2);Reset(Beanie_dd);Reset(BeanieQty);Reset(BumpHat_dd);Reset(BumpHatQty);Reset(CityTown);Reset(FemaleCleanJanSize_dd);Reset(FemaleCleanJanLL_dd);Reset(FemaleCleanJanQty);Reset(FemaleCleanJanWaist_dd);Reset(FemaleMascotShortsSize_dd);Reset(FemaleMascotShortsQty);Reset(FemaleOxfordWhiteShirtBust_dd);Reset(FemaleOxfordWhiteShirt_Qty);Reset(FemaleOxfordWhiteShirtSize_dd);Reset(GloveSize);Reset(GlovesQty);Reset(HiVisJacket_dd);Reset(HiVisJacketQty);Reset(HiVisWaistcoat_dd);Reset(HiVisWaistcoatQty);Reset(LadiesFleece_dd);Reset(FemaleFleeceQty);Reset(LadiesHolsterTrousersLL_dd);Reset(LadiesHolsterTrousersQty);Reset(LadiesHolsterTrousersSize_dd);Reset(LadiesHolsterTrousersWaist_dd);Reset(LadiesOfficeTrousersLL_dd);Reset(LadiesOfficeTrousersQty);Reset(LadiesOfficeTrousersSize_dd);Reset(LadiesOfficeTrousersWaist_dd);Reset(LadiesPoloShirt_dd);Reset(LadiesPoloShirtQty);Reset(MaleBerteeShortsQty);Reset(MaleBerteeShortsWaist_dd);Reset(MaleBlackOfficeTrousersWaist_dd);Reset(MaleBlackOfficeTrousersLL_dd);Reset(MaleBlackOfficeTrousersQty);Reset(MaleCleanJanWaist_dd);Reset(MaleCleanJanLL_dd);Reset(MaleCleanJanQty);Reset(MaleOxfordWhiteShirtChest_dd);Reset(MaleOxfordWhiteShirtNeck_dd);Reset(MaleOxfordWhiteShirt_Qty);Reset(MensFleece_dd);Reset(MensFleeceQty);Reset(MensHolsterTrousersLL_dd);Reset(MensHolsterTrousersQty);Reset(MensHolsterTrousersWaist_dd);Reset(MensPoloShirt_dd);Reset(MensPoloShirtQty);Reset(PPEPack_tgl);Reset(PPEPackQty);Reset(Postcode);Reset(ShoeBootName_dd);Reset(ShoeBootSize_dd);Reset(SoftShellUnisex_dd);Reset(SoftShellUnisexQty);Reset(SupManPicker);Reset(UnisexShortsBlackWaist_dd);Reset(UnisexShortsBlackQty);Reset(UnisexSweatshirt_dd);Reset(UnisexSweatshirtQty);Reset(UnisexTradesHolsterLL_dd);Reset(UnisexTradesHolsterQty);Reset(UnisexTradesHolsterWaist_dd);Reset(UnisexWaterproofQty);Reset(UnisexWaterproofJacket_dd);Reset(WhiteHardHat_dd);Reset(HardHatQty);


/* THIS WILL NAVIGATE THE USER TO THE SUCCESS SCREEN */
Navigate(Success_Scrn,Fade)

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,317)