Email notification with attachments

Options

Hi all,

This is not NXT related. But I, a Power Automate newbie, hope to get some help with the issue I have got stuck for days.

I am setting up the Power Automate flow to receive the MS form responses with uploaded files and notify the team members. The flow checker showed 0 errors, but the test runs failed. Here are my flow and the error message. Any directions or solutions are greatly appreciated.

788db0f77a59142d6f1e58c660b8fc92-huge-im
c84d96110d7f8fc32f8792462259cb13-huge-im

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Julia Chu
    since it is telling you that your Get file content action is errored out. then you need to look at what dynamic content you provided to the File field in Get file content and then check the action that produced that dynamic content and see if it is correct.

    I have a similiar flow that has upload file that I want to get the file content and attach to email.

    You “must” first use Parse JSON (it's not actually a must, but will make your life easier using dynamic content)

    49e4a17d8e4cf525bc62051cf797f341-huge-im

    Where it say “Content” you will provide the dynamic content of the question that is for uploading.

    For Schema, you can use this:

    {

    "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"

    ]

    }

    }

    This is assuming your upload question is requried, if NOT required (optional question), then you will need to put this Parse JSON in a condition that checks if any file upload happened.

    Then in your Get File Content action, you need to provide the location of the file uploaded. Since Forms allow multiple file to be uploaded, the Parse JSON will always return an “array” (list) of file uploaded, if you limited your Form question to upload only ONE file, then you can use the below where I am ONLY taking the “FIRST” file uploaded.

    953752cb072aa00bedcaa93c3e97dd47-huge-im

    @{first(body('Parse_JSON_Signed_Agreement'))?['driveId']}.@{first(body('Parse_JSON_Signed_Agreement'))?['id']}

    Parse_JSON_Signed_Agreement is the name of the Parse JSON action you gave to the action. If you named the action as Parse JSON Upload File, then you will replace Parse_JSON_Signed_Agreement with Parse_JSON_Upload_File, where all “space” character is replaced with an “underscore” character.

    Once you edited the highlighted yellow above with the correct name of the parse json action, you can copy (from the @ symbol to the end curly braces } symbol) and directly paste onto the File field in your Get File Content action, and it should appears like what I screenshoted.

  • @Alex Wong Thank you for pointing it out that I need to a condition control since the file upload is not required.

    My level so far only allows me to select from dynamic content. But there are not true or false options for the upload file parameter. I will need to work on writing the codes on Code View then.

    d1e7c9f3da736f4de08fb2a75ec13142-huge-im
    ecc06670f90a7037f962cc3eda3313a8-huge-im

    {

    "type": "If",

    "expression": {

    "and": [

    {

    "contains": [

    "@body('Get_response_details')?['ree6c7e8a6d044071ba8a8556d4a6d438']",

    ""

    ]

    }

    ]

    },

    "actions": {},

    "else": {

    "actions": {}

    },

    "runAfter": {

    "Apply_to_each": [

    "Succeeded"

    ]

    }

    }

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary 1,500 Likes 2500 Comments Name Dropper

    @Julia Chu
    You cannot edit “code view”. it is read only.

    You just need condition on the question is not answered, and by not answered, you use the empty() expression

    2368995a5c24d1a18f8e670f5e60d714-huge-im

    I see that you are using the “new editor” which I am not using due to buggy situation Microsoft hasn't fixed yet, you can continue to use the “new editor” unless you start finding out it causes unexpected issue for you.

    so basically when you click on the “left” of the dropdown (the dropdown for “is equal to” etc), you will go into expression mode and type in empty() and between the open/close paranthesis, you will select the question that is the upload question. on the “right” side of the dropdown, you will do an expression too, and you will type in false.

    (sometime it works by selecting the question of the upload to the “left” and then use “is not equal to” as the operator and leave the “right” side “blank”), you can try and see.

Categories