cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RBS1995
Helper II
Helper II

Add attachment from form to email and create a task in planner

I am trying to create a flow which people submit a form and can (but not always) include an attachment and get it to send an email then create a task and include attachment if applicable.

This is my flow currently after trying to follow multiple pages and guides:

How to use Upload File from Microsoft Forms in Power Automate - Fabozzi's Compiled Knowledge

Solved: Re: Working with files from the Forms "File Upload... - Power Platform Community (microsoft....

Microsoft Forms now supports attachment uploads! – Loryan Strant, Microsoft 365 MVP

Working with Files on MS Forms in MS Power Automate (bythedevs.com)

I have labelled each picture with expressions under all the pictures.

1RBS1995_0-1669736022136.png

 

2RBS1995_1-1669736142401.png

 

3RBS1995_2-1669736867535.png 

 

4RBS1995_3-1669736937602.png

 

1 - json(body('Get_response_details')?['rdb8aa8697f304ceb80cf19241d4ac1c7'])

2 - 

{
    "type""array",
    "items": {
        "type""object",
        "properties": {
            "name": {
                "type""string"
            },
            "link": {
                "type""string"
            },
            "id": {
                "type""string"
            },
            "type": {},
            "size": {
                "type""integer"
            },
            "referenceId": {
                "type""string"
            },
            "driveId": {
                "type""string"
            },
            "status": {
                "type""integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceId",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}
 
3- first(body('Parse_JSON'))?['Marketing_Requests']
4 - first(body('Parse_JSON'))?['driveID'] . first(body('Parse_JSON'))?['id'
 
When trying to run this as a test, I get this error message
Unable to process template language expressions in action 'Parse_JSON' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'.
2 ACCEPTED SOLUTIONS

Accepted Solutions
v-chengfen-msft
Microsoft
Microsoft

Hi @RBS1995 ,

Do you want:
1. After the user submits the form, create the file submitted by the user in SharePoint
2. Email the file as an attachment
3. According to the information in the form, create a Task and update the details
4. Delete files in OneDrive.

Here is test for your reference:

Here is form:

vchengfenmsft_1-1669777758890.png

Here is flow:

 

vchengfenmsft_0-1669777725133.png

vchengfenmsft_2-1669777777372.pngvchengfenmsft_3-1669777783724.png

vchengfenmsft_4-1669777789118.png

 

Here is link for your reference:

Re: Multiple attachments in Form with branching fl... - Power Platform Community (microsoft.com)

 

 

Best Regards

Cheng Feng

 

View solution in original post

Hi @RBS1995 ,

You can add a branch,

when the user does not upload a file,

[Apply to each] will fail, when it fails, execute the flow of this branch.

vchengfenmsft_1-1669888450139.png

vchengfenmsft_0-1669888438226.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it.

 

Best Regards

Cheng Feng

 

View solution in original post

12 REPLIES 12
v-chengfen-msft
Microsoft
Microsoft

Hi @RBS1995 ,

Do you want:
1. After the user submits the form, create the file submitted by the user in SharePoint
2. Email the file as an attachment
3. According to the information in the form, create a Task and update the details
4. Delete files in OneDrive.

Here is test for your reference:

Here is form:

vchengfenmsft_1-1669777758890.png

Here is flow:

 

vchengfenmsft_0-1669777725133.png

vchengfenmsft_2-1669777777372.pngvchengfenmsft_3-1669777783724.png

vchengfenmsft_4-1669777789118.png

 

Here is link for your reference:

Re: Multiple attachments in Form with branching fl... - Power Platform Community (microsoft.com)

 

 

Best Regards

Cheng Feng

 

Hi Cheng,

 

Thanks for this.

I have followed this, and it seem to be failing on the Apply to Each step:

RBS1995_1-1669815489107.png

 

 

Thanks

Reece

Hi Cheng,

 

Can you post the JSON parameter please?

 

Thanks

Reece

Hi @RBS1995 ,

Do you upload files while testing?

What is put in json() is:

json(outputs('Get_response_details')?['body/rac0e039a421b4e809a637f6667df1edc'])
vchengfenmsft_0-1669863183026.png

Best Regards

Cheng Feng

RBS1995
Helper II
Helper II

Hi @v-chengfen-msft , 

 

Yes I have included and attachment this time around but also wanting to make it so if people dont attach a file, it wont fail.

 

Also I was meaning the JSON parameter in the append array variable - sorry.

 

Thanks

Reece

Hi @RBS1995 ,

Here is JSON parameter:

I used a compose to show this:

vchengfenmsft_0-1669885883312.png

Could you show your flow and do a test again, and take a screenshot of the place where the error is reported?

 

 

Best Regards

Cheng Feng

Hi @v-chengfen-msft 

 

It is this one I am needing.

I's not sure how to enter the same format as what you provided previously.RBS1995_0-1669886186614.png

Apologies for the ignorance, I am still getting to grips with PA.

 

Thanks

Reece

HI @RBS1995 ,

Please try :

{
"Name": @{items('Apply_to_each')?['name']},
"ContentBytes": @{body('Get_file_content')}
}

 

Best Regards

Cheng Feng

 

Hi @v-chengfen-msft 

 

I have added this and ran it and the test ran first time!

However, it is showing this on the email:

RBS1995_0-1669887030943.png

Is this how it should show?

It does have the attachment on the email also

 

Thanks

Reece

Hi @RBS1995 ,

I think you should send these files as attachments。

like this :

vchengfenmsft_0-1669887358709.png

 

Best Regards

Cheng Feng

 

Hi @v-chengfen-msft 

 

I have applied this, and it works great!

I have submitted a form without an attachment also and it failed.

 

Is there a way to make it work if users don't attach a file onto the form?

 

Thanks

Reece

Hi @RBS1995 ,

You can add a branch,

when the user does not upload a file,

[Apply to each] will fail, when it fails, execute the flow of this branch.

vchengfenmsft_1-1669888450139.png

vchengfenmsft_0-1669888438226.png

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it.

 

Best Regards

Cheng Feng

 

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,923)