cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IuliaM
Regular Visitor

Error caused by One Drive file content returning null

Hello,

I am trying to attach files to send to an email address so I created a File Holder Array. This is what I append to it:

"name' is from One Drive file metadata; 

"contentBytes" is from One Drive file content;

"Email" is taken by splitting file name no extension on '_' (file name is like this "ABCD ABCD_someone@gmail.com.xlsx"  )

IuliaM_0-1620979970179.png

Before adding the email, this file holder was enough to attach all files without errors using Send an email (V2).

After adding the email, contentbytes is always assigned to null, despite the file content not being changed.

 

Hope you can help me to solve this problem 🙂

 

Thank you so much in advance!

Iulia

 

 

6 REPLIES 6
zaphod88
Responsive Resident
Responsive Resident

Could you show me the whole split() formula? The problem might be that split() is returning an array - you have to select the specific array item to get a single string.

Hi zaphod88,

 

I work with Iulia on this Flow and will answer when she's not around. There shouldn't be any issue with the split() function, we get the email wherever we use it. As specified, only the "ContentBytes" section turns out null, everything else works as intended. For reference, that split() looks like this: 

split(string(item()?['NameNoExt']),'_')[1]
zaphod88
Responsive Resident
Responsive Resident

Okay, unfortunately that was my only idea on that so far. 🙂 Could you try to insert a Compose action (and choose the array to be composed) to check if there is a problem with creating the array or with the Send email action?

The array "succeeds" when its populated at the start; it shows with a green checkmark, Name and Email populate as expected, but ContentBytes is null.

 

First iteration we did not have an Email property in the array; only Name and ContentBytes. At this point, ContentBytes was being populated correctly and emails were being sent with attached files. But some logic further down required us to save the Email too in the array, hence we added the field. At this point, ContentBytes broke for every element in the array.

 

Thank you for your replies; hopefully this comment shed some light on our situation.

 

Claudiu

zaphod88
Responsive Resident
Responsive Resident

I honestly have no idea at this point why this is happening, but maybe a workaround: What about creating another array, containing Name and Email, and get rid of Email in your File Holder variable? Then you can identify the records belonging together by the Name property as long as it's unique. Maybe not the most elegant way, but it might be working...

ClaudiuG
Regular Visitor

We just fixed it!

 

The "File content" dynamic element was originally copied from a different array that we worked with. It was at this point that it started returning null. I assume the reference broke. Our flow worked as expected once we deleted the old "File content" and replaced it with a new one selected from the Dynamic Elements menu.

 

We probably should have tried this sooner, but we didn't expect it to break when copying elements around.

 

Thanks for taking an interest in this issue. Hopefully this thread will be of help to someone in a similar spot.

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.

Top Kudoed Authors
Users online (3,341)