cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cbohlman
Frequent Visitor

SharePoint Update Item, if input is blank do nothing

Hello,

 

I am trying to write a flow that updates one Sharepoint list based on the input values of a second SharePoint list. The flow works well for the fields that require an input in the Data Entry list. However, for the optional fields that are left blank the flow is updating the Records list with a blank field as opposed to leaving it as the original value.

 

Is there an expression that will let tell the field to update with the new value if it exists and to do nothing if it is blank? (Other fields will need to be updated so it is only some fields that may not be updated)

1 ACCEPTED SOLUTION

Accepted Solutions
v-LilyW-msft
Community Support
Community Support

Hi @cbohlman 

Do you want to judge whether the input is empty? If it is empty, keep the original value, if not, replace it with the input?

You take a try to use the if() function to achieve it. I set up a flow, you can refer to below screenshots:

The following are my two lists. Flow is triggered when the item in ListA is modified. If the TestColumn in ListA has a value, update the TestColumn in ListB. Otherwise, keep the original value of ListB.

vLilyWmsft_4-1647915582305.png

vLilyWmsft_1-1647915212146.png

vLilyWmsft_2-1647915483581.png

Expression:

if(empty(triggerOutputs()?['body/TestColumn']),items('Apply_to_each')?['TestColumn'],triggerOutputs()?['body/TestColumn'])

vLilyWmsft_3-1647915508784.png

Hope the content above may help you.

Best Regards

If my reply helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-LilyW-msft
Community Support
Community Support

Hi @cbohlman 

Do you want to judge whether the input is empty? If it is empty, keep the original value, if not, replace it with the input?

You take a try to use the if() function to achieve it. I set up a flow, you can refer to below screenshots:

The following are my two lists. Flow is triggered when the item in ListA is modified. If the TestColumn in ListA has a value, update the TestColumn in ListB. Otherwise, keep the original value of ListB.

vLilyWmsft_4-1647915582305.png

vLilyWmsft_1-1647915212146.png

vLilyWmsft_2-1647915483581.png

Expression:

if(empty(triggerOutputs()?['body/TestColumn']),items('Apply_to_each')?['TestColumn'],triggerOutputs()?['body/TestColumn'])

vLilyWmsft_3-1647915508784.png

Hope the content above may help you.

Best Regards

If my reply helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you! That expression worked! I had been struggling with getting the syntax right so I appreciate the help!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,944)