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

Flow not working due to 'null' - adding link of Forms attachment to Sharepoint List

Hello there,

 

I have created an automation to add a Forms attachment into a Sharepoint List, under a Hyperlink column as below:

phishseng91_1-1623999885032.png

 

phishseng91_0-1623999403843.png

I used the expression first(body('Parse_JSON_-_Get_Forms_attachment'))?['link']

 
The problem is now that if there are no attachments, it creates an error where the first() expression expects an array but gotten a null instead. How do i edit the expression to work for a possible 'null' situation as well?
1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User II
Super User II

Hi @phishseng91,

 

You could check if the body of the Parse Json action is empty. If not, collect the first item.

 

Below is an example of that approach.

Replace the 'Not empty, do something' with whatever you want to do. In this case collecting the first item of the array.

if(empty(body('Parse_JSON_-_Get_Forms_attachment')), '', 'Not empty, do something')

 

View solution in original post

2 REPLIES 2
Expiscornovus
Super User II
Super User II

Hi @phishseng91,

 

You could check if the body of the Parse Json action is empty. If not, collect the first item.

 

Below is an example of that approach.

Replace the 'Not empty, do something' with whatever you want to do. In this case collecting the first item of the array.

if(empty(body('Parse_JSON_-_Get_Forms_attachment')), '', 'Not empty, do something')

 

View solution in original post

phishseng91
Frequent Visitor

Hello @Expiscornovus !

 

Thank you so much! It works now!

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,858)