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 / Select contact | looku...
Power Apps
Unanswered

Select contact | lookup contactlist

(0) ShareShare
ReportReport
Posted on by 21

Hi,

 

I spent many hours on a maybe simple task.

 

I conected my SharePoint list "events" with an lookup in a column called "contactID" to a contactlist. This part works fine.

 

Now in powerapps I try to select a contact that belongs to an event. I want to:

  1. search a contact
  2. select it
  3. display all details in textfileds
  4. save the change to the eventlist

I tried it with a dropdown or a combobox, but I have no idea how I get it working. Sorry...

 

Can someone help me?

 

Tiemo

Categories:
I have the same question (0)
  • PowerAddict Profile Picture
    7,316 Most Valuable Professional on at
    Hi,
    Not sure how far you are in your app design but this is a high level approach that should meet your needs:
    1. Have a gallery of events
    2. Have another gallery of event contacts that is filtered by the event selected in the 1st gallery. Something like Gallery1.Selected.Contacts
    3. Having a Contacts gallery will allow you to search for contacts
    4. When a user clicks on a contact from the 2nd gallery, navigate to a screen which has an Edit form. Set the Item property of the form to Gallery2.Selected.
    5. The form will have a button that will use the SubmitForm function to save your edits and bring the user back to either the Contacts gallery or the Events gallery.

    Let me know if this helps.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Hardit Bhatia
    https://thepoweraddict.com
  • v-siky-msft Profile Picture
    on at

    Hi @TheLuckyOne,

     

    Do you mean you want to search a contact and display or edit contact details, after edit, bind this contact to a event?

    Please check my steps:

    1. Add a combo box, set Items property: Choices(Events.ContactID)

    2. Add a EidtForm, set Items property: LookUp('Contactlist',ID=ComboBox1.Selected.Id)

    3. Add a button, set OnSelect property: SubmitForm(Form1);Patch(Events,First(Events),{ContactID:ComboBox1.Selected})

    Note: I patch the contact to first record of event list, you can change to modify other record. Reference: Patch function 

    Snipaste_2019-12-31_16-52-17.png

    Sik

  • TheLuckyOne Profile Picture
    21 on at

    Hi Sik,

    thanks for your reply. I tried to use a combo box before, but I am not very familiar with datatypes and functions of powerapps. I will learn!

     

    I will try both versions to understand more of powerapps. first yours. I have three Topics to ask:

    1. How can I display the company Name AND the full Name for selecting in the combo box
    2. How can I search the columns surname and Company
    3. When I go to another event there is still the selection from the Event before in the combo box. Can I change the default selection to none or the actual one?

    @PowerAddictI will do your Version next

    Tiemo

  • v-siky-msft Profile Picture
    on at

    Hi , 

    Could you share more details and screenshots? Where should the combo box be? in EditForm or gallery or standalone?

    I assume it is standalone.

    To get your requirements, we have to change another workaround. Retrieve the Contact list in combobox directly instead of using Choices function.

    1. Add a combo box, set Items property to 'Contact list'

    2. Set Field layout to Double, and modify the Primary text and Secondary text to display the company Name AND the full Name

    3. Set SearchFields property to ["surname","Company"], then you can search by two columns

    4. Add a EidtForm, set Items property: ComboBox1.Selected.

    5. Add a button, Set OnSelect property: SubmitForm(Form1);Patch(Events,First(Events),{ContactID:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id: ComboBox1.Selected.ID,Value: ComboBox1.Selected.<Contact>}}) //<Contact> is the column ContactID lookupAfter all, it can select the contact, edit the detail form, bind the selected contact to the first event record. If you want to change to bind to other records, just replace the First(Events) part.

    To your third question, you have to modify the DefaultSelectedItems property of combobox. What i can say is that you have to put a record form the 'Contact list' in this property, which means it should have the same table structure with combo box item. 

    So for example,  if you want the combo box to display that default contact of first event record, you can apply LookUp('Contact list', ID=First('Test-1009').OID.Id) to DefaultSelectedItems property.

     

    Sik

     

     

     

     

    Snipaste_2020-01-02_14-10-35.png

    @TheLuckyOne

  • TheLuckyOne Profile Picture
    21 on at

    Hi Sik,

     

    I am very close to the solution of my topic.

     

    Here ist what I see:

    1.jpg

     

    I don't need to edit the contact here. I will do this in another app. So I chose the View-Mode.

    What I have to do is to patch the selection of another contact on change of the combo box. I tried some variations of your Code (Vermietungsdaten = eventlist, Kontakt-ID = ContactID):

     

    Patch(Vermietungsdaten;Gallery1.Selected;{Kontakt_x002d_ID:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference";Id: ComboBox1_1.Selected.Id;Value: ComboBox1_1.Selected.<Contact>}})

     

    I am not sure, what to change, because I don't understand the part starting at @. Can you help me one more step?

     

    Why do I have to write ; instead of ,? Everywhere I find code with kommas, but power apps studio wants semikolons.

     

    Tiemo

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

    Hi @TheLuckyOne ,

     

    To patch LookUp field of SharePoint,  you have to patch a record containing '@odata.type', Id and Value.

    For the '@odata.type' field (Which I think is a predefined column), just copy and paste the following:

    '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"

    Id: The ID of the reference record

    Value: The value of the related column

    So you still replace the <Contact> to the related column of contact list in your formula

     

    The reason of semicolons is up to your language, Some European countries use commas as periods and semicolons as commas. Reference: Formula separators and chaining operator 

    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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard