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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Append to array variab...
Power Automate
Unanswered

Append to array variable - Dynamic "type" depending on file

(0) ShareShare
ReportReport
Posted on by 142

Hi,

 

I did try and search but didn't find anything to really help with my query. I've got a Flow that can have multiple attachments submitted via a Form .xlsx, .docx etc (Airwolf Inc is a fictional company FYI):

Screenshot 2022-03-27 171135.jpg

 

 

I have this array variable:

 

Screenshot 2022-03-27 171105.jpg

 

to loop through and grab those files and then attach them to a Planner Task. All works wonderfully except they are all showing as Word documents on the Task from the "Word" specified type in the variable:

 

 Screenshot 2022-03-27 172712.jpg

 

When you click them they open in their correct programs docx in Word, xlxs in Excel etc. Could anyone help me get the "type" in the variable to be the type of the file so that they have the correct icons in the Planner Task or is that just not possible please?

 

I'm not sure if this is relevant but the files don't show with an extension in the Task either in the current form and I suspect that is due to the renaming operation I have previous to this step:

 

Screenshot 2022-03-27 172712.jpg

 

Removing the renaming Step left me with one with the correct extension and the other (an .xlsx file) without one completely so I think I can safely assume that it's not down to the renaming Step but the type being specified in the array variable:

 

Screenshot 2022-03-27 172547.jpg

 

I'm thinking I need to "loop through the attachments and get the type of file and save that into another variable to call it through" but have no idea how I would start to do that.

 

Any help greatly appreciated and happy to provide more details or screenshots of my Flow if needed.

Categories:
I have the same question (0)
  • jedunn Profile Picture
    123 Microsoft Employee on at

    I believe you will need to add a step to your flow that gets the file extension of the form attachments and then make sure this is written as a part of the file name when the planner task's attachment is created.

    Here is an example of such a step.

    jedunn_0-1648493190085.png

    where the expression is this --> last(split(variables('AttachmentName'),'.')). In this case I have a previous step that sets a variable for the full 'AttachmentName'. This step and expression just get the extension.
  • CU31011410-0 Profile Picture
    142 on at

    Hi, thank you for your reply. I've tried to follow and copy what you did but I've hit a wall (I'm very new to PA).

     

    I've created this Compose Step and it gets the whole original filename, which I've then tried to reference in the step you showed in your example. For the below I get the error
    "Flow save failed with code 'InvalidVariableOperation' and message 'The inputs of workflow run action 'Compose_-_getFileExtension' of type 'Compose' are not valid. The variable 'Compose' must be initialized before it can be used inside action 'Compose_-_getFileExtension'.'.:

     

    Screenshot 2022-03-29 002011.jpg

     

    So I removed the Compose from the Expression and tried to use the dynamic value Outputs from the previous step that got the entire filename: last(split(variables('outputs('Compose')'),'.'))

    That gave me an The expression is invalid.

     

    So I gave it a hack and tried: last(split('outputs('Compose'),'.'))

    That gave me an The expression is invalid.

     

    Any chance you could give me a pointer into what your previous step looks like or how you manage to reference it in the following Compose - getFileExtension step please?

     

    Thank you for your time and expertise.

  • jedunn Profile Picture
    123 Microsoft Employee on at

    My apologies, I could have added more details. It looks like you were close on your first try. I think you need to first initialize the variable for the attachmentName. Secondly, set the variable with the value from outlook. thirdly, Use the compose step to trim off the extension.
    This pic may help. LMK if you get stuck again.

    jedunn_0-1648513218039.png

    There may be another post on the forum with many more helpful details.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard