web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / If sharepoint list A f...
Power Automate
Unanswered

If sharepoint list A field is blank dont replace field value in list B

(1) ShareShare
ReportReport
Posted on by 31

Hello,

 

I have built a flow that runs when an item is created in list A it will update list B.

Sharepoint list A = VRMaintenance

Sharepoint list B = LegacyVM

 

List B could possibly have data in the field already and if the corresponding field in list A is blank I dont want it to replace the data with a blank. So this is what I'm trying to get: if the field is populated then overwrite with answer but if blank do not change the field.

 

List A has an updated phone # in the field but the email is blank so in this case I want to update list B with the phone # but leave the email field alone since its blank in list A.

I tried this expression and the flow ran successfully updating the phone number but the email field was blank in List A which it replaced the existing email in List B with a blank. I do not want this to happen.

cfordp_2-1701024772476.png

Phone # field: 

if(empty(triggerOutputs()?['body/Phone_x0023_']),items('Apply_to_each_3')?['body/field_19'],triggerOutputs()?['body/Phone_x0023_'])

Email field: 

if(empty(triggerOutputs()?['body/Email']),items('Apply_to_each_3')?['body/field_20'],triggerOutputs()?['body/Email'])

 

I've also tried this expression for updating phone# field

cfordp_0-1701023041228.png

if(isblank(triggerOutputs()?['body/Phone_x0023_']),items('Apply_to_each_3')?['body/field_19'],triggerOutputs()?['body/Phone_x0023_'])
 
The flow failed and I received this error:
cfordp_1-1701023111138.png

 

 
Can somebody please help me out with this.
 
Thanks in advance!

 

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @cfordp 

    Try using coalesce() expression. So if the value is null then it will replace the value which you supplied. See below.

     

    coalesce(triggerOutputs()?['body/Phone_x0023_'],items('Apply_to_each_3')?['body/field_19'])

    coalesce(triggerOutputs()?['body/Email'],items('Apply_to_each_3')?['body/field_20'])

  • cfordp Profile Picture
    31 on at

    Thank you for your response!

     

    Unfortunately this didnt work either. Using this expression allowed me to updated the phone number field but because the email was blank in list A (no update need for email in list B) if cleared out the email that existed in list B and replaced it leaving field blank

  • cfordp Profile Picture
    31 on at

    Adding more clarification to what my flow is doing. Its capturing updates that were submitted via form and creating an item in List A. Then depending on what kind of update the list item is categorized it will update the corresponding item in List B.

     

    For this example, the condition that is running is to Update Contact Preferences, so the form could be submitted to update both phone number and email or just one or the other.

    So if List A phone# field is showing a value then update it but if it is blank then no change

    if List A email field is showing a value then update it but if it is blank then no change

  • cfordp Profile Picture
    31 on at

    @Pstork1 

  • Pstork1 Profile Picture
    69,515 Most Valuable Professional on at

    Coalesce() is the right answer if the value for the column in list A is coming through as null. But if the value is coming through as a blank string then you need to use 

    if(equals(triggerOutputs()?['body/Email'],''),items('Apply_to_each_3')?['body/field_20'],triggerOutputs()?['body/Email'])

    Power Automate doesn't have an isBlank or isEmpty function.

  • cfordp Profile Picture
    31 on at

    Sorry this feels like it should be so simple for me to understand but I'm still not getting the result I want.

     

    List B prior to running flow (where I want the updates to occur)

    cfordp_0-1701270419818.png

     

    List A which captures the updates needed to be made to List B

    cfordp_1-1701270660859.png

     

    I used expressions in my update item step:

    Phonecoalesce(triggerOutputs()?['body/Phone_x0023_'],items('Apply_to_each_3')?['body/field_19'])
    Emailcoalesce(triggerOutputs()?['body/Email'],items('Apply_to_each_3')?['body/field_20'])

     

    The email updated just fine but the phone number (777-777-7777) in List B updated to a blank field since it was blank in List A

    List B after running flow:

    cfordp_2-1701271302995.png

    I dont want existing data in List B to be replaced if its blank in List A

     

    Am I doing something wrong? Or is there a better expression to use?

     

    Thank you so much in advance!

  • Pstork1 Profile Picture
    69,515 Most Valuable Professional on at

    AS I mentioned in my reply, Coalesce only works if the value is null. In the case of the phone number I suspect it is a blank string not a null. If that is the case you need to use the IF() statement to test if its blank. If it is you need to re-use the original value in B, otherwise use the value in the trigger.

  • cfordp Profile Picture
    31 on at

    Understood. I also tried this expression instead and the same result happened as explained in my pervious response.

     

    if(equals(triggerOutputs()?['body/Phone_x0023_'],''),items('Apply_to_each_3')?['body/field_19'],triggerOutputs()?['body/Phone_x0023_'])

  • Pstork1 Profile Picture
    69,515 Most Valuable Professional on at

    Is the apply to each loop processing entries in List B or List A? You need to get the value from List B and use that if the trigger value is blank. I suspect you are using the one from List A, which is probably the same as the one in the trigger.

  • cfordp Profile Picture
    31 on at

    This is the trigger from List A and then the get items from List B

    cfordp_0-1701354326676.png

     

    The apply to each loop is getting the value from List B

    cfordp_2-1701354546273.png

     

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 450

#2
Haque Profile Picture

Haque 366

#3
Valantis Profile Picture

Valantis 349

Last 30 days Overall leaderboard