Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Copy Sharepoint Item containg null Lookup FIelds

(0) ShareShare
ReportReport
Posted on by 14

When using Flow to copy a item in a Sharepoint LIst to another SHareoint List, I am running into problems handling Lookup Fields.

 

If the source Sharepoint Item has a Lookup field and its empty (null) and you try to create a new item from this source the Flow will throw an error because FLow (much like SHarepoint Designer in the past) can not hanlde setting a Lookup field to Null.

 

I would like to know if there is way using expressions that I can test the input field (from the source item) for null and then do nothing to avoid the error thrown.    I know I can instead use a text field in the target and set it to the Lookup field value and that is one solution but not the best one.

 

This is a really simple Flow that archives items from one Sharepoint List into another but there are multiple lookup fields and all of them can be empty -- actually FLow should be able to hanlde setting a lookup field to null but if I could use an IF expression that tests for null that might be a reasonable workaround

  • UpTimize Profile Picture
    18 on at
    Re: Copy Sharepoint Item containg null Lookup FIelds

    Hello

     

    Just stucked in the same issue and get it solved by passing ID=0 while the source item lookup field is null

     

    In this case, the copied  item will be created with an empty lookup value.

    I just use a condition If(empty(yoursourcelookupfield,null),0,yoursourcelookupfield)

     

  • SPMP Profile Picture
    14 on at
    Re: Copy Sharepoint Item containg null Lookup FIelds

    Of course except I want to create an item for both conditions so this would be doable by adding another Create Item Action for the other branch and not include the Lookup column in that branch.

     

    But this does not solve the problem as we have lists that have 3, 4 or even 5 lookup columns  so with 4 lookup columns the logic complexity becomes amazingly complex with so many combinations of possibilities.   What I really need is to able to put an Expression in the Create Item lookup column that will do nothing if the input is null and use the value if it is not null -- there appears to be no way to do that.   WIth that capability I can have many lookup columns and I don't need any complex set of conditions with multiple Create Item actions.

     

    Seem pretty straightforward to me and your solution really only works realistically if there is ONLY one lookup column that could be null -- its really unacceptable if there are multiple lookup columns any one of which could be null.

  • v-yuazh-msft Profile Picture
    on at
    Re: Copy Sharepoint Item containg null Lookup FIelds

    Hi @ SPMP,

     

    I have made a test on my side and please refer to the screenshot of my flow as below:

    1.png

    Note:

    1. The sharepoint list “report” and “report1” both have a “lookup repairshop” column with type “lookup”
    2. The expression of the Condition as below:

    @empty(triggerBody()?['lookup_x0020_repairshop'])

     

    When an item is created in the “report” list, and the “lookup repairshop” column is null, the flow would run successfully as below:

    2.png

    When an item is created in the “report” list, and the “lookup repairshop” column is not null, the flow would run successfully as below:

     3.png

     

    Regards,
    Alice Zhang

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow