I broke my flow and I cannot figure out why!! (Form Approval with attachment)

Options

I had an approval process that was working well then I moved the form it was attached to and now I broke it. The problem appears to be somewhere in the Parse JSON and the create a web link.

I created a form where the donor must upload a picture. Submitting the form starts an approval process.

Everything worked great until I moved the form to a Teams Group.

This is where the break is occurring. It has something to do with the Parse JSON and the Create Share link.

547c66cca662dd0a973a1cb725aed323-huge-im

6af4b42275edfe487c1588ed34ddfa7a-huge-im
7829d310a5a42e5bffba2a775b20db91-huge-im

Comments

  • Austen Brown
    Austen Brown Community All-Star
    Ninth Anniversary Kudos 5 Name Dropper Participant

    @Susan Fioribello - In the Parse JSON action, click the x for the item listed for "Content" and re-add the dynamic content output from the get response details action.

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Susan Fioribello
    all error fixing starts with the error itself.

    First is to ensure your run did happen when the form is submitted, if the flow has no run history, then you want to make sure your form ID is updated on the trigger step and the “get response” action. (when you “move” a form from user to group, i don't remember if that will change the form ID or not)

    Form ID highlighted in yellow (when you get the URL from the browser location bar when designing the form).

    https://forms.office.com/Pages/DesignPageV2.aspx?origin=NeoPortalPage&subpage=design&id=ExA3u5aBcDEfoooooooooo0000000000ooooooooooVUMFRXMkY4V0dVQjJSV1A3SzNWUzJTT1lDUyQlQCN0PWcu

    If flow does trigger (have a run history) check the action that failed and see what the error message is to determine what needs to be done. (if the flow failed at the Parse JSON action, your create share link action will not execute, see the Parse JSON action to see what the error is)

  • @Austen Brown
    I checked the Form ID, it is definitely loading. I re-added the schema for JSON and that appears to work. It looks like it is failing at Create Share Link. The error says “Nonspecified”

  • @Austen Brown
    The Parse JSON appears to be working but it is failing at the “for each” then the “create a share link fails as there is no data”

    I found this page and am following the steps but it isn't working. Approve a File Uploaded via Microsoft Forms – What Me Pa..Panic? (dontpapanic.com)

    Also, when I pull the dynamic fields for the Parse JSON the choices all start with “body” for example, there is no [id] there is only [body id]. When I chose it for the share link it doesn't say first(body(‘Parse_JSON’))?[‘id’]’ it says “first(items('For_each')['id'])” even though I pulled it in through the dynamic field.

  • Austen Brown
    Austen Brown Community All-Star
    Ninth Anniversary Kudos 5 Name Dropper Participant

    @Susan Fioribello - What is the apply to each (containing the create file link action) running off of? With the expression “first” you shouldn't need to put this action within an apply to each.

  • @Austen Brown
    When I had it working Create share link was not in a “For each”.

    But it keeps getting added automatically. in the Dynamic content the Parse JSON items all begin with the word Body. That wasn't the case prior. So when I chose “Parse JSON-Body id” the “For each” gets added.

    I suspect whatever I did to cause “Body” to appear is making the “for each” get added.

    If I take the Create share link out of For each, I get an error message that I need it. When the Create share link is in the For each loop it is not available for the Approval.

  • Austen Brown
    Austen Brown Community All-Star
    Ninth Anniversary Kudos 5 Name Dropper Participant

    @Susan Fioribello - There is a new designer bug that adds errant/unneeded apply to each loops. I recommend switching to the older designer, and pulling the link action out of the apply to each.

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Susan Fioribello
    new editor definitely has more issue that's unknown, so use old editor (the switch is on the upper right corner of flow window) like Austen said

    However, the Apply to Each is “correct"ly placed by flow b/c a single question on form for uploading CAN allow uploading of more than 1 file, even when you can limit the question to allow only single file to be uploaded, FLOW connector action has to accommdate the potential “array” of file being uploaded.

    The Parse JSON schema tells the flow that there is an array of file, so when you reference one of the field for the file upload (i.e. id) in your create share link action, flow will automatically place the action in an Apply to each for the array of files uploaded.

    You can go one of 2 path:

    • leave the Parse JSON as is (benefit is less change)
      • remove the dynamic content from the Create share link action and drag and move the action outside of the apply to each and delete the apply to each
      • in the dynamic content, put in this expression:
        first(body('Parse_JSON_Donation_picture_upload'))?['id']
    • change the Parse JSON to only look at the first file of the upload question (benefit is to allow you to get all of the file upload property, including name, without using first() expression on all of them, and flow will never create a new Apply to each loop when you directly select the field for the file upload)
      • in the Content field of Parse JSON action, remove the dynamic content (which is the file upload question), and go to expression and type in first(), then put your text cursor between the paranthesis and go to dynamic content and select the file upload question
      • change the Schema to what I have below
      • remove the dynamic content from the Create share link action and drag and move the action outside of the apply to each and delete the apply to each
      • then directly select the id dynamic content from the parse json action

    Schema to use if you select option 2 above:

    {

    "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": {}

    }

    }

  • @Austen Brown
    I tried switched to the old designer but it also added the “For each”.

    Is it possible that my JSON schema is doing something to make this happen?

  • @Alex Wong @Austen Brown

    I am getting so frustrated with this. No matter what I do I cannot add the attachment to the Approval. Classic example of why you should make a copy before fussing with a flow!

    Would one of you be willing to do a zoom or teams session with me to figure out this one issue?

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Susan Fioribello
    I will use what you are trying to do as sample for my session in bbdevday: 6/6 Thursday session on Power Automate Tips and Tricks at 3PM-3:45PM EDT. If you signed up for bbdevday and is attending, you can come to the session to learn.

    https://blackbaud.swoogo.com/bbdevdays2024

    if you are not, I will see if I can get the video recording posted for you later on

  • @Alex Wong

    Unfortunately, Thursday is our staff development day so I won't even be on the computer. I would love a recording!

    Thank you so much!!!

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Susan Fioribello
    here's link to the on demand video

    If you are unable to access, @Erik Leaver maybe can help.

  • @Alex Wong
    What a great session! I am so sorry I wasn't able to attend live.

    I followed your instructions. The problem is that [id] from either is not showing as an available field

    bb7fca967f551dc04aa90b1688d9d78c-huge-im

    b27d6a6dfe150872e7166e19e410043d-huge-im
    6558b0857c44b003c9479c684269ff11-huge-im
  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Susan Fioribello
    the reason why you do not see the id dynamic content is b/c the action to create share link require field Item Id is looking for an integer, which id is not an integer, so power automate “smartly” not show it. i just notice this this morning that id doesn't work to create share link, you need another step in between.

    Get file metadata using path (you will need to compose your path from where you know the folder of the upload and then add the name of the file from the 2nd parse json.

    then you will get the ItemId from the get file metadata action.

    d35082b5dbc170a377e5c09b6333bbbd-huge-im
  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Susan Fioribello
    bbdevdaytestuploadfilecreatesharelink_20240607180455.zip

    b9efb6276b3f97373072dee45bdcef04-huge-im

    decodeUriComponent(replace(body('Parse_JSON_Require_Single_File_Upload_First_File')?['link'], 'https://yourorgsharepointurl/teams/BusinessAutomation', ''))

    expression used above will use the link dynamic content from the 2nd parse json and decode it to a path that can be used after replacing the initial part of the url that is the site address. This way you don't need to worry about knowing the folder path of where to find your uploaded file.

    use the zip file to import and try it out

  • @Alex Wong

    Woo Hoo!!! It works perfectly!

    I cannot thank you enough for all of your help and patients.

    You are amazing!

Categories