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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Incompatible type whil...
Power Apps
Unanswered

Incompatible type while try to Patch from People combo box

(0) ShareShare
ReportReport
Posted on by 265

Hi,

 

I'm not sure whether this is related to my previous threat, but I got an error while using Patch to update my Sharepoint list whereby the source contain User/People combo box.

 

So this is my patch code :

 

Patch(Visit, 
{ Title:txtTitle.Text,
 Traveler:{
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & cboEmpoyee_1.Selected.Mail,
 Department:"", 
 DisplayName: cboEmpoyee_1.Selected.DisplayName,
 Email: cboEmpoyee_1.Selected.Mail
 },
 'Reason For Visits':txtReason_1.Text
}

 

 

So, basically I have 3 controls: txtTitle, txtReason_1 which is a single text type, and the cboEmployee_1 is the combo box with User list (People).

 

And the error is pointing to "DisplayName" which is am using for the combo box which in the end it will update my field in Sharepoint with type of User/people. 

 

Voltes_0-1603290031816.png

 

Anyone can advice what's wrong with this ? and how to resolve it ? 

 

Thanks,

Categories:
I have the same question (0)
  • Voltes Profile Picture
    265 on at

    Hi,

     

    Sorry, turned out it is a typo error on the combo box name.

    However I still cannot save it as there is an error :

    The requested operation is invalid. Server Response: Visit failed: The specified user i:0#.f|membership| could not be found. clientRequestId: 9a8d78ad-5813-4ddc-8c87-623ae02f442b serviceRequestId: 9a8d78ad-5813-4ddc-8c87-623ae02f442b

     

    When I tried to take a look at the "cboEmployee_1.Selected.Mail" by show it in Label control, it looks like it is empty at first, and will only have value after we click (select) from the combo box. Does it means because I put the default value on the combo box, the box not yet been selected ? Is that why the error says "the specified user not found" ? Then what to do when we're using combo box which have property DefaultSelectedItem filled in ? based on the name, doesn't it mean it supposed to be selected already ?

     

    Thanks

     

     

  • Verified answer
    v-siky-msft Profile Picture
    on at

    Hi @Voltes ,

     

    I guess the Combobox Items is Office365Users.SearchUsers(), the correct DefaultSelectedItems property must have the same data structure as the Items property, so the easiest way is use LookUp function to retrieve on the Office365Users.SearchUsers().

    Please modify the combobox.DefaultSelectedItems property as follows.

    LookUp(Office365Users.SearchUser(),Mail=User().Email)

    Then modify the Patch code as follows.

    Patch(Visit, Defaults(Visit),
    { Title:txtTitle.Text,
     Traveler:{
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & cboEmpoyee_1.Selected.UserPrincipalName,
     Department:"",
     DisplayName: "",
     Email: "",
     JobTitle:"",
     Picture:""
     },
     'Reason For Visits':txtReason_1.Text
    }

    Hope this helps.

    Sik

  • Voltes Profile Picture
    265 on at

    Hi,

     

    It works!

    How to know what's the structure looks like from that "Office365Users.SearchUsers()" returned, if I may ask ?

     

    Much thanks.

     

  • v-siky-msft Profile Picture
    on at

    Hi @Voltes ,

     

    See the output of SearcUser action of Office365 Users connector.

     

    Sik

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard