cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Hollymood
Frequent Visitor

Dropdown of Lookup column needs to auto populate itself.

Hello!

 

My app is based on two Sharepoint lists CMS and CMS_Notes.

Users submit tickets and can check the status of them.

I'm trying to give them the ability of adding Notes.

 

The notes should obviously be linked to the specific ticket, but saved on a different list.


CMS Lists has the following columns:

ID, Title, Name, Email, Phone, ItemRequested, Description, , Deadline, Status, etc....

CMS_Notes has the following columns:

ID, Note (single Line of text), TicketID (lookup to ID on CMS).

 

Now, to give you an idea of the layout, I have two sidebars, on the left Gallery1 where they can see and select the tickets, in the center Form1 that shows the info and allows them to edit the ticket, and on the right, the second sidebar, where on the top they have Gallery2 showing the notes attached to the Selected ticket and right under, a little form that should allow to only type a note and submit.

 

Here is my problem, how do I make sure that when they select a ticket on Gallery1, my dropdown lookup TicketID (Form2) automatically select the ID of the active ticket on Gallery1 and Form1?

 

I have tried so many different things and read so many posts that I got so confused that I feel like I have unlearned powerapps. I don't know with which property to work anymore, item, default, update, etc...

 

Please help!!!

 

Daniele

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Warren,

 

I finally got it to work. What did the trick was changing the TicketID type from lookup to number.

 

With a number type of value I simply pre-populate the field (Default is set to Gallery1.Selected.ID), hide it, and save it using SubmitForm(Form2); NewForm(Form2).

 

Then to show the Notes when a Ticket on Gallery1 is selected, I used Filter(CMS_Notes,OriginalID=Gallery1.Selected.ID) on Gallery2 Items.

 

Thank you so much Warren for helping me with this!


Daniele

 

 

 

View solution in original post

9 REPLIES 9
WarrenBelz
Super User
Super User

Hi @Hollymood ,

Can you please supply in text the Items property of both the first two galleries and a screenshot.

Hollymood
Frequent Visitor

Sure, thank you!!! I'm sorry about the long code in Gallery1, It was the only way I could make it work. Basically it allows three bosses of three different departments to see all the tickets that belong to their specific department.

 

Gallery1 (Items)

Sort(
If(
ToggleStatus.Value = true && User().Email = "123456@miami.edu",
Filter(
CMS,
Status.Value = dropdown_Status.SelectedText.Value && Department.Value = "TAL"
),
ToggleStatus.Value = true && User().Email = "234567@miami.edu",
Filter(
CMS,
Status.Value = dropdown_Status.SelectedText.Value && Department.Value = "EPS"
),
ToggleStatus.Value = true && User().Email = "345678@miami.edu",
Filter(
CMS,
Status.Value = dropdown_Status.SelectedText.Value && Department.Value = "KIN"
),
ToggleStatus.Value = true,
Filter(
CMS,
Status.Value = dropdown_Status.SelectedText.Value
),
If(
ToggleStatus.Value = false && User().Email = "123456@miami.edu",
Filter(
CMS,
(!((Status.Value = "Completed") Or (Status.Value = "Cancelled"))) && Department.Value = "TAL"
),
ToggleStatus.Value = false && User().Email = "234567@miami.edu",
Filter(
CMS,
(!((Status.Value = "Completed") Or (Status.Value = "Cancelled"))) && Department.Value = "EPS"
),
ToggleStatus.Value = false && User().Email = "345678@miami.edu",
Filter(
CMS,
(!((Status.Value = "Completed") Or (Status.Value = "Cancelled"))) && Department.Value = "KIN"
),
Filter(
CMS,
(!((Status.Value = "Completed") Or (Status.Value = "Cancelled")))
)
)
),
Created,
Ascending
)

 

Gallery2 (Items)

Filter(CMS_Notes,TicketID.Value=Gallery1.Selected.ID)

 

I'll attach the screenshoot in a second.

 

Hollymood
Frequent Visitor

ScreenShotApp01.png

OK thanks @Hollymood ,

The bit that had me a little confused was why you are giving the user a choice of TicketID when you already know it.

Your notes edit form is based on ‘CMS Notes’ and the Item should be ‘Gallery 2’.Selected. This will show the required record.

With the dropdown, you could replace it with a label, but the easiest way would be to make the DisplayMode of the card DisplayMode.View instead of Parent.Default. The user could then see the TicketID but cannot change it.

 

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.

 

I replaced the dropdown (It was a dropdown because the column is a lookup of ID on CMS) with a label DisplayMode.View.

Now it shows the correct ID number and it's not editable, sweet! I was actually planning to hide it like for Created and CreatedBy, but I'll do it in the future.

 

My problem is that I still cannot get the submit button to record the TicketID value.

 

When I click "Submit" it only records, Note, Created & CreatedBy. TicketID column is empty.

 

any idea?

Ok @Hollymood ,

So I can be clear on your process behind all of this, is the ticket screen a new record on another list with several comments available per ticket or a field in the existing list where you simply add to the comments?

I assume the first, what is the Update property of the Card containing the Ticket ID?

Also try setting the Control rather than the Card to DisplayMode.View (leave the Card at Parent.Default)

Hi Warren,

 

you got it right, when they want to add a note, they add a new record on another list that can have several notes per ticket.

The relationship between the two sharepoint lists is a field on the list CMS_Notes called TicketID (lookup type) linked to ID on the main list (CMS).

 

To answer your question...

what is the Update property of the Card containing the Ticket ID?

I tried Gallery1.Selected.ID but I get the error Expected Record Value

 

I believe my big problem here is that the field TickedID is a lookup type, and I don't know how to preselect a value from its dropdown equal to the ID on the main table (CMS).

 

I hope it makes some sense to you.

Ok @Hollymood ,

So you are launching NewForm(FormName) and want the TicketID to auto-populate?

So, try this - on the code that launches the new form, put 

UpdateContext({vTicket:ThisItem.TicketID.Value})

There are other ways of getting this, such as the contents of a control on the screen - the main thing is to set the Variable to this value before the new form is lunched. Now simply set the Default of the control in the new form containing the TicketID to vTicket.

 

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.

 

Hi Warren,

 

I finally got it to work. What did the trick was changing the TicketID type from lookup to number.

 

With a number type of value I simply pre-populate the field (Default is set to Gallery1.Selected.ID), hide it, and save it using SubmitForm(Form2); NewForm(Form2).

 

Then to show the Notes when a Ticket on Gallery1 is selected, I used Filter(CMS_Notes,OriginalID=Gallery1.Selected.ID) on Gallery2 Items.

 

Thank you so much Warren for helping me with this!


Daniele

 

 

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,710)