cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Patch Distinct() dropdowns to SharePoint

Hello,

 

I have dropdown2_1 which depends on the selection of dropdown1_1

 

To transfer the data to SharePoint I'm using: Button > OnSelect: Patch(ServiceTerritory_ZipCode, Defaults(ServiceTerritory_ZipCode),{DistrictManager:Dropdown1_1, Technician:{Value:Dropdown2_1}, ZipCode:{Value:TextInput1_1}, DMNotes:{Value:TextInput1_2})

 

but it gives me an error message saying "The requested operation is invalid. Server Response: Object must implement IConvertible. clientRequestId:"

 

Any idea where the point of failure could be? I've researched and encountered similar but no the exact same scenario. Any help would be highly appreciated.

 

Thank you community!

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous ,

You still have to refer to the control values properly.

Text Boxes are

COntrolName.Text

ComboBoxes or DropDowns are

ControlName.Selected.xxxx

where xxxx depends on the Items property of the control.

When you type YourControlName.Selected. (note second dot), valid values will come up underneath. For some guidance of what they mean: -

  • If your Items are Choices(ListName.FieldName) - a Choices or Lookup field), the reference will be YourControlName.Selected.Value
  • If they are Distinct( . . .  .), it will be YourControlName.Selected.Result
  • The other option is when they are based on a field value in a list (other than Distinct), then it will be YourControlName.Selected.FieldName (actual field name)

You also need to refer to the field type you are writing to. If Text, then the above will work. If a Choice Field, you need

{Value:YourControlOutput}

 

Please click Accept as solution 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 Thumbs Up.

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User III
Super User III

Hi @Anonymous ,

You have a closing } bracket missing for a start.

Patch(
   ServiceTerritory_ZipCode, 
   Defaults(ServiceTerritory_ZipCode),
   {
      DistrictManager:Dropdown1_1, 
      Technician:{Value:Dropdown2_1}, 
      ZipCode:{Value:TextInput1_1}, 
      DMNotes:{Value:TextInput1_2}
   }
)

you have also used {Value: . . . } on the fields Technician, ZipCode and DMNotes. Are these all Choice fields in your data source? If I assume

 

  • District Manager is Text but chosen from a drop-down
  • Technician is a Choice Field from a Dropdown
  • Both ZipCode and DMNotes are Text from text box inputs

would need something like.

Patch(
   ServiceTerritory_ZipCode, 
   Defaults(ServiceTerritory_ZipCode),
   {
      DistrictManager:Dropdown1_1.Selected.Value, 
      Technician:{Value:Dropdown2_1.Selected.Value}, 
      ZipCode:TextInput1_1.Text, 
      DMNotes:TextInput1_2.Text
   }
)

It could be a mix of all of this, but you need to properly refer to both the control output and the data source type you are Patching to.

 

Please click Accept as solution 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 Thumbs Up.

Anonymous
Not applicable

Thank you for your kind reply. I noticed I pasted the wrong code, I'm currently using the following:

 

Patch(
ServiceTerritory_ZipCode,
Defaults(ServiceTerritory_ZipCode),
{
DistrictManager:Dropdown1_1,
Technician:Dropdown2_1,
ZipCode:TextInput1_1,
DMNotes:TextInput1_2
}
)

 

But still the "Server Response: Object must implement IConvertible...." Error message appears.

 

We can no longer user Selected.Value, that doesn't exist anymore.

 

😞

 

 

@Anonymous ,

You still have to refer to the control values properly.

Text Boxes are

COntrolName.Text

ComboBoxes or DropDowns are

ControlName.Selected.xxxx

where xxxx depends on the Items property of the control.

When you type YourControlName.Selected. (note second dot), valid values will come up underneath. For some guidance of what they mean: -

  • If your Items are Choices(ListName.FieldName) - a Choices or Lookup field), the reference will be YourControlName.Selected.Value
  • If they are Distinct( . . .  .), it will be YourControlName.Selected.Result
  • The other option is when they are based on a field value in a list (other than Distinct), then it will be YourControlName.Selected.FieldName (actual field name)

You also need to refer to the field type you are writing to. If Text, then the above will work. If a Choice Field, you need

{Value:YourControlOutput}

 

Please click Accept as solution 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 Thumbs Up.

 

View solution in original post

Hi @Anonymous ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution 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 Thumbs Up.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,500)