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

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
Community Support

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.

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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Users online (5,726)