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

Power Automate + Power Apps: Getting Json with "Ask in PowerApps" doesn't work in the flow, but if pasted in a compose, it works

Hello

 

Anyone else experienced that the Json with "Ask in PowerApps" doesn't work in the flow, but if pasted in as compose, it works?

I'm taking a gallery on Power Apps, making a JSON in "OnSelect" on a button and importing it in the flow to populate an excel file with a table.

 

Overview of flow:

TerjeFR_0-1663851835714.png

 

With "Ask in Powerapps":

TerjeFR_1-1663851874945.png

 

With the "Ask in PowerApps" output written to a .txt file and pasted instead:

TerjeFR_2-1663851986943.png

 

Why does the pasted JSON work, but when i try to do it directly, it doesn't do the same thing? 🙂

When I do it directly, it creates the excel file and the table, but table is empty. When run with the pasted JSON, the table is full.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
TerjeFR
Regular Visitor

I think I've found the error. The HTML / Excel table needs jo have the content from Power Apps inside a JSON code:

 

 

json("Content from Power Apps")

 

View solution in original post

5 REPLIES 5
annajhaveri
Community Champion
Community Champion

@TerjeFR  can you take both the json, from one PowerApps (from flow run) and one from compose action and provide the json here?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.
TerjeFR
Regular Visitor

The JSON that gets created from Power Apps is the same JSON that i pasted manually. The only difference is the method of how the flow gets the JSON provided. In theory it should be the same, but I don't know if I have to make any additional steps to get the JSON I get directly from Power Apps to work the same way.

 

From Power Apps, creating the JSON to import:

ForAll(Gallery1.AllItems,Collect(colDataExported,{
    Kontrollobjekt: ThisRecord.QaRecordName,
    Link: ThisRecord.DocumentLink,
    Sjekkliste: ThisRecord.ChecklistID,
    EKstatus: ThisRecord.SubmissionID.StatusEK,
    EKsign: ThisRecord.SubmissionID.SignEK,
    EKdato: ThisRecord.SubmissionID.DateEK,
    EKkontrolldokument: ThisRecord.DocumentationEK,
    SKstatus: ThisRecord.SubmissionID.StatusSK,
    SKsign: ThisRecord.SubmissionID.SignSK,
    SKdato: ThisRecord.SubmissionID.DateSK,
    SKkontrolldokument: ThisRecord.DocumentationSK,
    Godkjentstatus: ThisRecord.StatusApproval,
    Godkjentsign: ThisRecord.SignatureApproval,
    Godkjentdato: ThisRecord.DateApproval
    }));

EksporttilExcelMalv2.Run("", "", "", JSON(colDataExported,JSONFormat.IncludeBinaryData & JSONFormat.IgnoreUnsupportedTypes));

Clear(colDataExported);

 

The JSON that is created, and works when pasted, but not directly:

[{"EKdato":"2022-09-20","EKkontrolldokument":"www.bygg.no","EKsign":"jgro","EKstatus":3,"Godkjentdato":"2022-09-15","Godkjentsign":"TFR","Godkjentstatus":"Signert","Kontrollobjekt":"1111111111111111","Link":"www.bygg.no","SKdato":"2022-09-20","SKkontrolldokument":"www.bygg.no","SKsign":"jgro","SKstatus":3,"Sjekkliste":"BK10"},{"EKdato":"2022-09-02","EKkontrolldokument":null,"EKsign":"jgro","EKstatus":3,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"2222222222222222","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK21"},{"EKdato":"2022-09-02","EKkontrolldokument":null,"EKsign":"jgro","EKstatus":3,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"3333333333333333","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK31"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":1,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"4444444","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":4,"Sjekkliste":"BK81"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Femte kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK82"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Spesialkontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK40"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"BK 41 kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK41"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Kontroll 100","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK42-1"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Kontroll 100","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK42-2"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK42-3"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK43-1"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK43-2"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":"BK40"},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":null},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":null},{"EKdato":null,"EKkontrolldokument":null,"EKsign":null,"EKstatus":null,"Godkjentdato":null,"Godkjentsign":null,"Godkjentstatus":null,"Kontrollobjekt":"Ny kontroll","Link":null,"SKdato":null,"SKkontrolldokument":null,"SKsign":null,"SKstatus":null,"Sjekkliste":null}]

 

With JSON directly:

TerjeFR_0-1663915426027.png

Directly from "Ask in PowerApps":

TerjeFR_1-1663915467105.png

 

TerjeFR
Regular Visitor

The same happens when i try to create an HTML that i convert into PDF. Everything works if I paste JSON into the

Power Automate flow, but when I try to have it imported directly from Power Apps - Gallery, I get nothing.

 

Is there a simple fix I can't see? 🙂

 

Power Automate flow:

TerjeFR_0-1664348598539.png

 

JSON created from Power Apps Gallery:

ForAll(Gallery1.AllItems,Collect(colDataExported,{
    Kontrollobjekt: ThisRecord.QaRecordName,
    Link: ThisRecord.DocumentLink,
    Sjekkliste: ThisRecord.ChecklistID,
    EKstatus: ThisRecord.SubmissionID.StatusEK,
    EKsign: ThisRecord.SubmissionID.SignEK,
    EKdato: ThisRecord.SubmissionID.DateEK,
    EKkontrolldokument: ThisRecord.DocumentationEK,
    SKstatus: ThisRecord.SubmissionID.StatusSK,
    SKsign: ThisRecord.SubmissionID.SignSK,
    SKdato: ThisRecord.SubmissionID.DateSK,
    SKkontrolldokument: ThisRecord.DocumentationSK,
    Godkjentstatus: ThisRecord.StatusApproval,
    Godkjentsign: ThisRecord.SignatureApproval,
    Godkjentdato: ThisRecord.DateApproval
    }));

EksporttilPDFviaHTML.Run(JSON(colDataExported,JSONFormat.IncludeBinaryData & JSONFormat.IgnoreUnsupportedTypes));

Clear(colDataExported);

 

TerjeFR
Regular Visitor

I think I've found the error. The HTML / Excel table needs jo have the content from Power Apps inside a JSON code:

 

 

json("Content from Power Apps")

 

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!

Users online (1,665)