Link to home
Start Free TrialLog in
Avatar of Larry Heimendinger
Larry Heimendinger

asked on

PowerApps - Patch not working on lookup column

I created a quick PowerApps to copy records from one SharePoint list to a similar, new one.  Made some tweaks in the new list, and one of those was to make a column a lookup ; the source table for the copy has the column as a single line of text.

 When the app runs, all the records copy over, but just two of them have a value in the new lookup column and neither of those values correspond to the value of the text columnin the source.  The remainder are just blank.

 The app is very simple:  I created two galleries, one with items = 'source table' and the other with items = 'target table' and a button that contains the following expressions:

 ForAll('source',
Patch('target',Defaults('target'),
   {Title:Title,
    Quantity:Value(jc_ItemQuantity),
    OrderedBySmiley Surprisedrdered_x0020_By,
    DateOrderedSmiley Very Happyate_x0020_Ordered,
    OrderComments:Comments,
     Store: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id:'Items  Ordered'[@ID], ValueSmiley Frustratedtore},
    StatusSmiley SurprisedrderStatus,
    DateShippedSmiley Very Happyate_x0020_Shipped,
    ShippingComments:jc_Comments,
    DateReceivedSmiley Very Happyate_x0020_Received,
    DateOnHoldSmiley Very Happyate_x0020_on_x0020_Hold,
    OnHoldComments:jc_Comments,
    DateCanceledSmiley Very Happyate_x0020_Canceled,
    OnHoldReasonSmiley Surprisedn_x0020_Hold_x0020_Reason}))

 The red part is what is not working properly.  Since all of the other fields do copy properly, I have assumed that the FORALL causes the data to advance in the source list and that by grabbing those values in the PATCH it would work.  So, Store as a text field in the source should copy over as the "lookup" result in the target, right?

 I have tried at least a dozen expressions and this is the only one that did not give me a PATCH error on the button.

 Thanks in advance for your help.
Avatar of Larry Heimendinger
Larry Heimendinger

ASKER

I solved this but forgot to post.  The issue was that the Store column in the source list was a text field while a lookup field in the destination.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.