cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Users online (8,143)