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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Defaut Selectred items...
Power Apps
Answered

Defaut Selectred items - Combo box- In EditForm (Embedded)

(0) ShareShare
ReportReport
Posted on by 641

Hi,

 

I want to show defualt value of combo box which is depended on another first combo box field that is too coming from another list.

If I changed  the value of first field then its defualt value is sets but when i opened already save form then its not coming.

 

I am using- On First field (combobox-

OnSelect- ClearCollect(valSelected,{Value:DataCardValue2.Selected.'FullName',CityRequired:DataCardValue2.Selected.City,Id:DataCardValue2.Selected.ID});

 

DataCardValue2 is my first combo box field

CityRequired : I want this to be set(Which is sets successfully when i changed the combobox)

 

On my second field- Items: ValSelected

DefualtSelectedItems: valSelected.CityRequired

 

Categories:
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @panand99 ,

    You omitted the important bit for saving - the Update of the Data Card that DataCardValue2 is in - try this for a start

    {
     CityRequired:DataCardValue2.Selected.CityRequired
     Id:DataCardValue2.Selected.Id
    }

    also I would have thought your DefaultSelectedItems should reflect the current field

    {CityRequired:ThisItem.CityRequired}

     

    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.

  • panand99 Profile Picture
    641 on at

    Thanks @WarrenBelz  for your help, but the thing here is it doesn`t work properly with that. Let me provide you all details here.

     

    -> I have two lookup fields in spo, 1st is name and 2nd is city.

    -> On 1st

    OnChange/OnSelect Event- ClearCollect(valSelected,{Value:DataCardValue2.Selected.'Name',City:DataCardValue2.Selected.City,Id:DataCardValue2.Selected.ID});

    here DataCardValue2 field is 1st combobox

    defaultselecteditems: Parent.Default

    Items: Filter('SPList',StartsWith('Full Name',DataCardValue2.SearchText))

    the value of name combobox can be changed based on user typing in that combobox field.

     

    the 1st field is working fine.

     

    Now, on the second 'City' lookup field, I want to show city of 'NAME' (1st lookup field) ,

    In my case, if user changes value of 'Name' field, then it shows the 'city' accordingly but the issue arises when i opened the already saved record. it does not show the default value of city based on name which is already seelcted.

     

    The formula of second city field is- Items-ValSelected,

    Defaultselecteditems- Thisitem.Name:City (If i used that then it will show defualt field but not changing field when i change the name).

    if i used valSelected.City, then it will only show me value when i changed the name, but now showing me when i open the already saved form.

     

    @RandyHayescan u please help me on this.

    Thanks,

     

     

     

     

     

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    @panand99 ,

    I can probably help now you have posted the whole issue, but happy to leave you with @RandyHayes if he is on line.

  • panand99 Profile Picture
    641 on at

    Dear @WarrenBelz 

     

    I didn`t mean like that I don`t need you help/advise. It will very much welcomed. 

     

    I just mentioned Randy only for the advise.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @panand99 

    Jumping in as requested.  @WarrenBelz makes important points about the updating of the values to the list.

    So, based on that, my question (which I don't see address in the thread) is are the values from the comboboxes being written to the list properly?  You mention "Which is sets successfully when i changed the combobox" - does this mean that it is written to the form list properly?

     

    Also not seen is, what kind of column in your list is Name and City?  You state they are Lookup columns, but are the multi-select lookup, or single value?

     

    There is no need for a collection or OnChange/OnSelect action.  This is only going to cause problems.

     

    Since you are dealing with Comboboxes your DefaultSelectedItems property needs to MATCH the signature of the Items property for the combboxes or nothing will be selected.

     

    Now, before I continue too much, you are basing a formula you have on SearchText - I would believe this is going to cause you a problem as a user could type a Name into the combobox that perhaps does not exist.  Thus your second combobox will not have a value.

    I would recommend that we base the second off of the selected value of the first.


    Please verify/clarify before we proceed.

     

     

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Thanks @RandyHayes ,

    As you have done the work here (along the path I was heading pretty much), I will leave this with you. I have also just got out of bed, so could not answer until now anyway.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @WarrenBelz 

    No problem Warren.  I am coming up on bed time going the other direction.  So, if any word from @panand99 please feel free to jump in.  

    I'm not sure if you're the night shift or if I am...😂

    Have a good day!

  • panand99 Profile Picture
    641 on at

    Thanks for the help @RandyHayes @WarrenBelz ,

     

    I am using search text in combobox because my list contains more than 5000 records and I created an inbuild powerapps app (sharepoint integration) And to provide option to user to search from destination list.

     

    My first list is document library where it have 1st lookup column (NAME) and the 2nd one 'City' in selected from same lookup field (sharepoint column settings).

     

    Now, if I change the 1st name column value and saves then close the form, it sets the correct city value (lookup from list).

     

    The only thing is pending is to it can`t show me the value of city once I changed the name in run time.

     

    Thanks again.

     

     

     

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @panand99 ,

    We can now focus on this -

    The only thing is pending is to it can`t show me the value of city once I changed the name in run time.

    Sorry if I am repeating a question you have detailed somewhere in your posts, but can you please supply

    • The Items of this Combo Box
    • Its DefaultSelectedItem
    • The Update of the Data Card it is in
    • Its Name
    • The the name and type of field it is writing back 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.

     

  • panand99 Profile Picture
    641 on at

    Thanks @WarrenBelz for your reply.

     

    As required:

    for city combobox:-

    • The Items of this Combo Box
      • Filter('SPList',StartsWith('Name',DataCardValue2.SearchText))  // DataCardValue2 is the first combobox name
    • Its DefaultSelectedItem
      • Parent.Default
    • The Update of the Data Card it is in - DataCardValue3.Selected
    • Its Name - DataCardValue3
    • The the name and type of field it is writing back to
      • Name:city, lookup.

    Please let me know if any other information required.

     

    Thank you very much.

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard