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

Parse Json error for Attachments

Im getting an Error for the parse Json for gathering the values of an attachment. i have posted a screenshot below. the flow wont get past the parse json

 

Parse Json Code:

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

 

 

 

 

parse json.png

 

19 REPLIES 19
Anonymous
Not applicable

Hi @ParmSandhu ,

 

1. try removing  " "type": {}," from the code and check.

 

Regards,

Chandrashekhar

ChadVKealey
Memorable Member
Memorable Member

Can you provide a screenshot of the error you see in a failed run? A close-up of it (rather than the whole screen) would be best. I honestly can't make anything out in the screenshot you posted; the text is too small and when I zoom in, it gets all pixelated.

ChadVKealey
Memorable Member
Memorable Member

Also, are you certain that you selected a file upload question as the "Content" for the Parse JSON action? That schema only fits with "File upload" questions from a Microsoft Form. 

Yes it is a file upload question on forms, but it is not required, think that was worth mentioning.

error.PNG

ChadVKealey
Memorable Member
Memorable Member

If you submit the form and attach/upload a file, does the flow work? If so, this behavior is expected. Basically, if you don't attach/upload a file, the response to that question is empty (null), which doesn't fit the schema that the action is using. If you don't plan to make the file upload required, you can add a condition that evaluates the response to that question and ONLY does the parse json (and other file-related steps) if that response is NOT null.

Thanks Chad i started realizing that after running a couple of test runs and tried setting a condition. But am having issues with that as well because i am unsure of how to set a condition to tell the process that there is an attachment provided. i have posted another post here:

https://powerusers.microsoft.com/t5/Building-Flows/Condition-Control-in-power-automate-for-Attachmen...

 

 

so i have figured out the conditions and the parse json is passing now but now i am getting stopped at the "Get file meta data" im not sure what is causing this i am using the same steps as the video. here is the error.

 

file metadata error.PNG

 

ChadVKealey
Memorable Member
Memorable Member

That error means that it can't find the file that you're specifying in the input for the action. Can you provide a screenshot showing the input for the Apply to each loop and the Get file metadata action?

 

Ensure that the input for Apply to each is the "Body" being output from the "Parse JSON" action.

 

Also, make sure the input for the Get file metadata action is the "driveId"."id" (the dot/period in between is required!), also being output from the "Parse JSON" action.

Get file metadata input
{
    "method""get",
    "path""/datasets/default/files/b%25219bFCJ9HphUOgKe0yfEWfHubU0Dvw5wBNmvKSd3UNCog5kRNL5WzORLlbWzaSj8e8.014KXUNJEKVCYJ6VJLFNA3X3YDDGR7XQY2",
    "host": {
        "api": {
        },
        "connection": {
            "name""/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/shared-onedriveforbu-596ddbfc-814e-4887-9181-5fd2-8bee2210"
        }
    },
    "authentication": {
        "scheme""Key",
        "parameter""*sanitized*",
        "type""Raw"
    }
}
getfile.PNG

 

it is the body from the parse json and the driveid is items('Apply_to_each')['driveId'] same with the id. and i do have a period between them.
 
ChadVKealey
Memorable Member
Memorable Member

Something's not right with that input. Did you manually create the "Apply to each loop" and set the input, or did you add the "Get file metadata" action and select the "driveId" (letting Power Automate create the Apply to each loop) as shown here: https://youtu.be/amByVPsgUw8?t=388

I did “get file meta data” and selected drive id and allowed power automate to create the apply to each loop function. I tried both ways and it still gave me an error.

ChadVKealey
Memorable Member
Memorable Member

OK, I'm not sure where things are going wrong for you, but I recorded a short walk-through showing what the inputs & outputs should look like: https://www.screencast.com/t/wxXM8V4qcy 

Thank you so much for creating that. so it seems that i get a different input for "Get file metadata". i think its worth noting that i am working off a shared forms and shared power automate, where i am not the original owner. would that have any issues in the matter? the parse JSON passes perfectly now.

 

Input for get file metadata

{
    "method""get",
    "path""/datasets/default/files/b%25219bFCJ9HphUOgKe0yfEWfHubU0Dvw5wBNmvKSd3UNCog5kRNL5WzORLlbWzaSj8e8.014KXUNJEKVCYJ6VJLFNA3X3YDDGR7XQY2",
    "host": {
        "api": {
        },
        "connection": {
            "name""/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/shared-onedriveforbu-596ddbfc-814e-4887-9181-5fd2-8bee2210"
        }
    },
    "authentication": {
        "scheme""Key",
        "parameter""*sanitized*",
        "type""Raw"
    }
}

Referring to PamShandhu post  on ""Get file metadata" error message. I experienced the exact same issue. Which I suspect is due to Shared Forms and Shared Power Automate workflow.

My conclusion was that the "Get file metadata" error will occur if

1. The Form is not originally created by ourselves

2. The Power Automate Flow is not originally created by ourselves

 

When I used a Form created by myself, and used the Flow described by Chad, the Uploaded file gets into the Email successfully.

 

If anyone has other solution, please share. Thank you

ChadVKealey
Memorable Member
Memorable Member

@Michael_Yen , to be more specific, a user can only "get file metadata" on files to which they have at least read access. If it's a personal form that you did not create, then those files are saved into the OneDrive of the form's creator and unless they specifically shared the folder where the files are stored with you, then you don't have access. That is, someone might create a personal form and "share" it with you; that gives you access to the form, but not to the OneDrive folder where the form is storing uploaded files. 

 

Now, if it's a group form, the files are stored in the group's SharePoint site, so any member of the group has access to the form itself as well as the files stored in SharePoint. 

 

Regarding creation/ownership of the flow...it's a more complicated situation. Really, it's about the connections used in the flow and what access they have to OneDrive, SharePoint, etc.

 

My examples assume that either it's a personal form and the flow is being created by (and run in the context of) the form's creator OR it's a group form and the flow is being created by (and run in the context of) a member of the group that owns the form. If you are sharing a form (personal or group) or sharing a flow, your results and experiences may vary.

Hi Chad

Thank you for your explanation.

It made sense.

When I guided my colleague who is the Owner of the Form to create the Flow, the File upload and email was triggered successfully.

 

I will see if  when she shares her OneDrive Folder containing the Form File Uploads, the original flow will work.

 

Best regards

I face the same issue. As a form collaborator, I am editing a shared flow to retrieve file metadata from a Shared Form and faces error. Manage to resolve it simply by getting the form/flow owner to allow my profile access to his/her OneDrive folder of that specific Shared Form. Test the flow and it works perfectly.

I added the condition and it worked to bypass JSON file upload. Thanks, now I just have to figure out how to get multiple files to upload instead of just the first one. 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages