cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ttaylor
Level: Powered On

Multiple comments based on dropdown selection

I think I may have a rather complex problem. Here's what I've done:

 

Step 1 - Main Screen (Contacts list),

Edit/view form (Form1) using a dropdown menu (OrgDropDown) from Contacts list; users select an Organization name from the OrgDropDown menu to populate Form 1. 

 

Step 2 - Notes Screen (Notes list), gallery form for users to see notes from prior visits to the Organization that was selected in OrgDropDown on the main screen, which uses Contacts list.

 

Step 3 - I need users to be able to add new note through a form that will save in the Notes list based on the organization that was selected from OrgDropDown on main screen Contacts list

 

Contacts list:  Organization field is single-line text field

Notes list:  Organization is a LookUp field from Organization in Contacts list

 

How do I do step 3? 

11 REPLIES 11
Community Support Team
Community Support Team

Re: Multiple comments based on dropdown selection

Hi @ttaylor ,

Do you want to know how to update a lookup field?

Is your data source sharepoint list?

Is  Organization a single lookup field?

If so, I've made a similar test for your reference:

1)a drop down display Organization in Contacts list.

Set the drop down's Items: Contacts list

Set the drop down's Value: Organization

Since the drop down is in an edit form, the drop down's value will become invalid after the form is submitted.

So you could set the item that the drop down selected as variable.

Set(a,Dropdown1.Selected)

2)in Step 3, the new form

Unlock Organization data card.

Set the combo box's DefaultSelectedItems:

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:a.ID,
                        Value:a.Title}

Then, the Organization combo box will be automatically filled in with the selection of step1 drop down.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ttaylor
Level: Powered On

Re: Multiple comments based on dropdown selection

My information is from a Sharepoint list. 

 

The dropdown1 on the main screen is from Organization in Contacts list. Organization is a single-line text field.

 

When I click the "add a new note" it opens in the Notes screen. This form is set to use the Notes list. The Organization field is this list is a lookup to the Contacts list.

 

I unlocked the datacard and added this:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        Id:a.ID,
                        Value:a.Title}

 I'm not getting any errors. However, the organization field does not show anything. Did I miss a step?

ttaylor
Level: Powered On

Re: Multiple comments based on dropdown selection

I've attached screen captures with notes that I hope will make more sense. Smiley Happy

 

Thank you so much for all your help!!

Community Support Team
Community Support Team

Re: Multiple comments based on dropdown selection

Hi @ttaylor .

Did you set the selection of drop down as variable?

Please set the selection of drop down as variable befor the form is submitted.

Set the drop down's Items: Contacts list

Set the drop down's Value: Organization

Set the drop down's OnChange:

Set(a,Dropdown1.Selected)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ttaylor
Level: Powered On

Re: Multiple comments based on dropdown selection

Well that's quite embarrassing. I forgot to set the variable. Thanks for being so patient. 

 

How can I refresh that box? I chose an organiation from OrgDropDown, however the Notes screen remembers the one prior one, not the current. It's always one step behind. Smiley Happy

egallis
Level 10

Re: Multiple comments based on dropdown selection

Hi @ttaylor,

I strongly recommend that when you want to pass data from one screen to another you use the UpdateContextRecord parameter of the Navigate function:

Navigate(NotesScreen,Transition.None,{ctxOrganization: OrgDropDown.Selected})

That context variable can then be used in your Notes screen for just any purpose. It should make your "one step behind" problem.

Hope this helped,

Emmanuel

ttaylor
Level: Powered On

Re: Multiple comments based on dropdown selection

Unfortunately, that didn't fix the problem. 

egallis
Level 10

Re: Multiple comments based on dropdown selection

@ttaylor,

Ok... Let's try to start this all over again... Here is what I suggest...

MAIN SCREEN

NotesButton.OnSelect = Navigate(NotesScreen, ScreenTransition.None, {ctxOrganization: OrgDropDown.Selected})

NOTES SCREEN

NotesGallery.Items = Filter(Notes, Organization.Id=ctxOrganization.Id)

If I were you, I would place a label on the screen just to check that the correct organization is passed from the main screen to this screen. For instance, set its Text property to something like:

Label1.Text = ctxOrganization.Id & "|" & ctxOrganization.Value

Then, in your NotesForm, you should have your Organization datacard hidden. Inside the datacard, set the DropDown properties like this (make your datacard visible just to check if it gets the correct value):

DataCardValue_Org.DefaultSelectedItems = LookUp(Choices(Notes.Organization),Id=ctxOrganization.Id)

That should (hopefully) do the trick...

Emmanuel

ttaylor
Level: Powered On

Re: Multiple comments based on dropdown selection

Now I'm getting nothing.

 

I was totally confusing myself so I renamed my columns:

 

Notes SharePoint list = OrganizationNOTES, which is a lookup column to

Contacts Sharepoint list Organization

 

Also, dropdowns don't accept DefaultSelectedItem, right? Before I was getting info on the Notes screen, it was just one step behind.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 304 members 4,274 guests
Please welcome our newest community members: