Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

OnSelect taking me to wrong record

OnSelect is taking me to the wrong record in my form. Sometimes when I choose a record from the gallery it takes to the correct item but other times it takes me to a form of another item. It happens randomly. This is what I am using. 

Refresh('Submitted Requests');If(!IsBlank(LookUp('Submitted Requests', Title=(Gallery2_3.Selected.Title))),Navigate('CR Form',ScreenTransition.CoverRight,{locMode:FormMode.Edit,varRecord:LookUp('Submitted Requests', Title=(Gallery2_3.Selected.Title))}), Navigate('CR Form',ScreenTransition.CoverRight,{locMode:FormMode.New,varRecord:Blank()}))


Resolver II
Resolver II

Are there multiple entries with the same Title in the data source or gallery? LookUp returns the first value that matches your formula; if there's multiple entries in the "Title" column that match "Gallery2_3.Selected.Title" it'll return whatever one it finds first. Consider using LookUp with an ID, else consider using Filter.

No they are unique. ID doesnt work for me because it also patches to two other data sources and the ID numbers are off. I have three galleries the first is the one that is originally submitted to when the form is submitted then onsuccess patches to two others. The reason I use title is because the ID's are different from each data source. The only thing I can think of is to override that by using a lookup for the ID so that is forces the other two datasources to use them instead of assigning the number in sharepoint. @zmorek 

Resolver II
Resolver II

Hello @powerapps890 


@zmorek  is correct.


Try this:

On the select record of the Gallery OnSelect: Set(recID,ThisItem.ID); Navigate('CR Form')

Next on the CR Form edit mode: Item Property: LookUp('Submitted Requests',ID=recID)


Helpful resources

User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (64,690)