web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Even though Json Varia...
Power Apps
Unanswered

Even though Json Variable has value, Power apps says its blank while passing it to power automate in Run action. Any help on this please.

(0) ShareShare
ReportReport
Posted on by
Categories:
  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Atharvazd , Could be please share more information on the code. Please show the code for variable.

     

    Thanks,

    ANB

  • Atharvazd Profile Picture
    on at

    I have declared one collection On start property of app.

    ClearCollect(TestCol,{
    TestFeild :TestFeildInput.Text,
    TestFeild2:TestFeildInput2.SelectedText

    };Clear(TestCol)

     

    Then i have a button on screen "Button1" which collects the data

    On select of Button1 :

    Collect(TestCol,{
    TestFeild :TestFeildInput.Text,
    TestFeild2:TestFeildInput2.SelectedText

    });Set(TestJsn,JSON(TestCol,JSONFormat.Compact&JSONFormat.IgnoreUnsupportedTypes&JSONFormat.IndentFour))

     

    and on submit button 

     

    PowerAppV2->RunaflowbuiltwithPowerAutomatefordesktop'.Run(TestJsn)

     

    When checked in Variable TestJsn is having the json value but still it gives error that its blank on submit button

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    HI @Atharvazd , The syntax of JSON is: 

    JSON( DataStructure [, Format ] )

    • DataStructure – Required. The data structure to convert to JSON. Tables, records, and primitive values are supported, arbitrarily nested.
    • Format - Optional. JSONFormat enum value. The default value is JSONFormat.Compact, which doesn't add newlines or spaces and blocks binary data and unsupported columns.

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-json

     

    Why are you using all 3 format in single code: Compact, IgnoreUnsupportedTypes and IndentFour

     

    Try this:

    Set(TestJsn,JSON(TestCol,JSONFormat.IgnoreUnsupportedTypes))

     -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • Atharvazd Profile Picture
    on at

    It seems the issue in If statement. 

     

    If(ValidationFlag<>0,Notify("Please provide the required details"),Select(Button1);'PowerAppV2->RunaflowbuiltwithPowerAutomatefordesktop'.Run(TestJsn);Select(ResetButton))

     

    In the else part i.e Defaults 

     

    Select Button1 - Collects the data in the collection and sets the value of Json

    Power app trigger- which triggers the power automate flow and variable TestJsn is passed

    Select Reset Button - Clears the collection.

     

    Upon checking in the power app monitor it seems the power app trigger is getting executed first and hence the error

  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    @Atharvazd : You didnt shared this code of "If" in your previous response. You should mention all details in one go.

     

    Try this

     

    If(ValidationFlag<>0,
     Notify("Please provide the required details"),
     Select(Button1)
    );
    If(ValidationFlag = 0,
     RunaflowbuiltwithPowerAutomatefordesktop'.Run(TestJsn);
     Select(ResetButton)
    )

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • ANB Profile Picture
    7,252 Super User 2026 Season 1 on at

    Hi @Atharvazd, Can you confirm whether the last suggestion that I gave helped you or not?

     

    Thanks,

    ANB

  • timl Profile Picture
    37,418 Super User 2026 Season 2 on at

    Hi @Atharvazd 

    The better way to do this is to call the Collect and JSON functions within your If statement, rather than Select the button. The reason for this is stated in the documentation:

     

    >> Select queues the target OnSelect for later processing, which may happen after the current formula has finished being evaluated. Select doesn't cause the target OnSelect to evaluate immediately, nor does Select wait for OnSelect to finish being evaluated.

     

    https://learn.microsoft.com/en-gb/power-platform/power-fx/reference/function-select

     

    If(
     ValidationFlag <> 0,
     Notify("Please provide the required details"),
     Collect(
     TestCol,
     {
     TestFeild: TestFeildInput.Text,
     TestFeild2: TestFeildInput2.SelectedText
     }
     );
     Set(
     TestJsn,
     JSON(
     TestCol,
     JSONFormat.Compact & JSONFormat.IgnoreUnsupportedTypes & JSONFormat.IndentFour
     )
     );
     'PowerAppV2->RunaflowbuiltwithPowerAutomatefordesktop'.Run(TestJsn);
     Select(ResetButton)
    )
    

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard