cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mcorning
Level 8

Re: Cannot delete Lookup field

I just closed a previous post under the Subject: Re: Cannot delete Lookup field. In that post i forward referenced the following additional remarks, and i pose two new questions.

 

First, I finally found all the info i needed to figure out how to use Entity Relations and the LookUp field CDS adds on my behalf. For posterity, i will summarize what i've learned about creating Entity Relations and LookUp fields here:

 

In our case, we have an entity that always has records generated by our users when they "modo up." These Modo entity records represent risky activities upon which our members have embarked. If they don't "modo down" at the end of the activity, we create a Search Incident record tied to the open Modo.

 

So the

  • Modo entity will always have data, but
  • not all Modos have a Search Incident record.
  • Conversely, all Search Incident records must have a Modo record parent.

 

Therefore, in the child entity, Search incidents, we create a relation called Modo_Incident using the Modo entity as the parent.

 

Modo_Incident Relation.pngModo/Search Incident Relationship

 

Here's the trick: you don't have to do anything else. CDS makes a new field in your child entity (viz., Search Incident for us). This is how the Relationship property values appear in the Search Incident Fields UI:

Modo_Incident.pngGenerated LookUp field

Note the disabled color, just like all the other System-controlled properties. I would have been less confused yesterday if the elipsis simply wasn't visible on properties I cannot control.

 

Regardless, the next thing i learned today was how to start using this new Lookup field in PowerApps. As I read elsewhere, when you create a PowerApp that depends on an Entity with a Relationship, dropdown controls provide the optics for the Lookup field in the parent entity, and you select the value in the child record from the list of all values in the parent entity field. In our case, we wanted a list of all Modo Id (PrimaryId) records.

 

searchIncident.pngThree references to same value

No here's where the first question comes in, and I think i have the answer, myself: Before today, i simply had a text field i used to manually enter the Modo Id of the Search Incident's parent Modo (that's the middle highlighted value). The problem, of course, was that my (late-bound) brain made little distinction between 000025 and 25, though the type-safe PowerApp would not find them equal. So the question is: do we need the Lookup field only? The answer seems obvious: Yes; but instead of a PowerApp using a formula like this to populate the bottom of the screen above:

LookUp(Modo, PrimaryId=DataCardValue2.Text)

where DataCardValue2 points to the Modo ID textbox

it would dereference the Modo ID like this:

LookUp(Modo, PrimaryId=DataCardValue1.Selected.Value)

where DataCardValue1 points to the Modo_Incident dropdown.

 

So now my second question (and one for which i do not have a ready answer): if i can drop use of the textbox, how do i bind a new Search Incident to a Modo at runtime in my Flow where the PrimaryId of the new Modo record becomes the input to the Modo_Instance[.PrimaryId?] in the subsequently created Search instance record?

 

I guess the answer is at my fingertips. I will create a Flow that creates a new Modo record then simply assigns the Modo_Instance field in the Flow to the value of the Modo Id[PrimaryId] in dynamic content. i won't be surprised if it's that easy.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,485)