Hello!
There are a few blog posts that show for Power Fx can be used in the command bar editor (preview) to create a new record. Using the Patch function with Self.Selected.Item, it is easy enough to create a copy of a record. However, I can't seem to get the Patch function to update the value of a lookup field.
To be more precise: the record I am trying to copy is a child record, in a N:1 relationship with a parent record. The child record is shown in a subgrid on a form for the parent record. As such, the child record has a lookup column that relates it to the parent record. I can easily use the Patch function with a custom button on the subgrid to create a copy of the child record... for every field except that lookup field.
Here is an excerpt of the the formula I am using (all tables are custom tables, no Dynamics in this environment). For simplicity's sake, I have included only two columns, a text column and a lookup column. In my scenario, Many Quotes relate to One RFQ. Quote # is a text column (primary name), and 'RFQ ID' is a Lookup column.
Patch(Quotes, Defaults(Quotes),{'Quote #':Self.Selected.Item.Autonumber & Self.Selected.Item.QuoteVersion + 1, 'RFQ ID':Self.Selected.Item.'RFQ ID'})
The button shows up as it should:

The form of the original record (the one I tried to copy) shows the relationship to the parent record, Test Project (this is why it shows up on the subgrid):

When I click on the subgrid command button, it does indeed create a new record, assigning the proper name. However, it does not relate it to the parent record (therefore does not show up on the subgrid in the parent record's form):

I also tried to use the Relate() function, but I can't seem to get that to work either. Any ideas? Thanks!