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

Patch Lookup Field to CDS New Record

Need help patching a new record to CDS via patch for lookup field. I am mirroring the solution from :https://powerusers.microsoft.com/t5/Common-Data-Service-for-Apps/Patching-User-Lookup-on-CDM/m-p/366...; however not successful...

 

Entity: Asset

Lookup Field: Asset_Location

ComboBox1: (Choices(Assets.Location))

 

Formula: Patch( Asset, Defaults(Asset), {Asset_Location: ComboBox1.Selected})

-

Result: Location field is blank.

2 REPLIES 2
Community Support Team
Community Support Team

Re: Patch Lookup Field to CDS New Record

Hi @FunGuy ,

 

The Items property of the combo box should be:

Choices(Assets.Location)

 

Please remove "()" and try again.

 

And for Patch formula, it seems that you only included the "Asset_Location" field. Please make sure that all the Required fields are included in Patch.

 

Regards,

Mona

 

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

Re: Patch Lookup Field to CDS New Record

I was able to patch the other fields required THEN patch the appropriate lookup field to that record; however, I am unable to execute them together in one patch line. Is it possible to make it all one execution given that the lookup requires an existing record?

 

Formula:

Patch(Asset, Defaults(Asset), {Asset_Name: "Test123"});

Patch(Asset, Lookup(Asset,Asset_Name="Test123"), {Location: Lookup(Locations_Table, Location_Name=Combobox1.Selected.Location_Name)})

 

Is it possible to store a lookup value (not as a text) in a collection?

I was thinking maybe Collect all the input data then use ForAll function to patch the specific lookup values.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

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 Kudoed Authors (Last 30 Days)
Users online (4,936)