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

How to add properties to a localVariable?

Hi, OnSelect of a Button I have the next code

 

UpdateContext({locDocument:MyPowerAutomateFlow.Run()})

 

 that code creates a context variable called locDocument it returns some properties from the flow like these

 

{
"name":"foo",
"id":"12234",
"base64":"SG9sYU11bmQ="
}

 

so I am able to use  in my app like locDocument .base64 or locDocument .id and so on. but I need to add more properties to that object (locDocument )

 

{
"name":"foo",
"id":"12234",
"base64":"SG9sYU11bmQ=",
"extra1":1,
"extra2":"string"
}

 

those extra properties are not handle by the MS Flow.

What can I do? thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

What do you mean those properties are not handled by MS Flow?  Are you referring to the issue with Respond to Power Apps trying to return a number?  Or just that the other properties aren't available in Flow?

 

You can't add more properties to the existing Context variable.  But you can create a new one that contains those properties and additional ones.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
Pstork1
Dual Super User III
Dual Super User III

What do you mean those properties are not handled by MS Flow?  Are you referring to the issue with Respond to Power Apps trying to return a number?  Or just that the other properties aren't available in Flow?

 

You can't add more properties to the existing Context variable.  But you can create a new one that contains those properties and additional ones.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Abhilash_Swain
Resolver II
Resolver II

@JesusPrim @If you are looking to add columns to locDocument, you can use AddColumns(please check the syntax).

 

If you are looking for your Flow's return value should contain these extra columns, then you need to adjust the flow . So that in return it will provide you those extra columns.

 

 

JesusPrim
Regular Visitor

@Pstork1 @Abhilash_Swain Hi thanks for reply. The flow just return 2 properties and thats it. it wont return more properties because aren't available in the MSFlow.

I've done something like this, it works but i think I'm doing the things wrong.

UpdateContext({locDocument:{
    response:MyPowerAutomateFlow.Run(),
    extracontent:{extra1:1,extra2:"foo"}
    }
});
StalinPonnusamy
Community Champion
Community Champion

Hi @JesusPrim

There is no easy way to add within Powerapps. We can do some splitting the response into the collection (A more tedious process), Add columns to add more properties, and to JSON.

 

The best approach is to send to another Power automate (It's easier in Power Automate). Which combines or add more properties. Get response as full JSON back.

Pstork1
Dual Super User III
Dual Super User III

Unless you want to create a separate Context Variable that is the best way to add additional values to locDocument.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,343)