Skip to main content

Notifications

Power Automate - Building Flows
Answered

updating a SharePoint lookup field

Posted on 22 Nov 2024 14:10:13 by 144
So I want to update a lookup field 'interface' which is multi-select.
My flow takes an Excel file and checks each row to see if it needs to update the SharePoint item or create a new one.
 
The file has the interfaces listed but not the IDs. I realised that I'd need these IDs from the SP list I'm looking up to. 
So I added actions which basically used a Filter array, Select and append to string variable to get these into an array of all the IDs.
 
My inputs for Update Item look like this for interfaces on one of the items:
"{\"ID\":1264},{\"ID\":1265},{\"ID\":1266},{\"ID\":1267},"
 
However, my outputs are empty for this column. What could I be doing wrong?
  • Expiscornovus Profile Picture
    Expiscornovus 30,523 on 25 Nov 2024 at 10:53:44
    updating a SharePoint lookup field
    Great to hear this worked for you @CAlvy 
  • CAlvy Profile Picture
    CAlvy 144 on 25 Nov 2024 at 10:21:10
    updating a SharePoint lookup field
    Thanks so much @Expiscornovus - that did the job.
    I didn't need the slice or replace as my inputs no longer had the \ or final comma, but I used the json and concat with the [ ].
  • Verified answer
    Expiscornovus Profile Picture
    Expiscornovus 30,523 on 23 Nov 2024 at 14:20:00
    updating a SharePoint lookup field
    The expected format would be:
    [
    {"ID":1264},
    {"ID":1265},
    {"ID":1266},
    {"ID":1267}
    ]
     
    You could use a slice to remove the last comma. After that you can use a replace to remove the '\' characters. And finally you can use a concat and json to turn it into a valid array.
     
    Below is an example
     
    json(concat('[', slice(replace(variables('StringArray'), '\', ''), 0, -1), ']'))
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,111

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,795

Leaderboard