cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ChrispyP
Level: Power Up

Not working: Using addproperty() to write to an empty Object Variable

Hi all, 

i am currently trying to build a flow to parse CSV to JSON - Reference: https://sergeluca.wordpress.com/2018/10/28/microsoft-flow-advanced-tutorial-creating-a-csv-converter...

I am already failing at the first step. 

Capture1.PNG

The "Test" variable is just an empty Object Variable, the code I use in the following compose step is: 

addProperty(variables('Test'), 'Email', 'yes')

So what it should be outputting is 

{
'Email':  'yes'
}


Does anybody have an idea why it is not recognizing the empty object variable as an object?

Error Message: 
Unable to process template language expressions in action 'Verfassen' inputs at line '1' and column '2035': 'The template language function 'addProperty' expects its first parameter to be of type object. The provided value is of type 'Null'.'.

I have already deleted the flow and done it over again. Any help is much appreciated 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Not working: Using addproperty() to write to an empty Object Variable

@ChrispyP 

So, this is all new to me but I did some playing around.  I think it's because the default value of your initialized variable is null, so there is nothing to add the properties to.

I added the dynamic value "Body" from the manual trigger and got the expected result. Maybe try that and see if that works.20190716b.PNG

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Community Support Team
Community Support Team

Re: Not working: Using addproperty() to write to an empty Object Variable

Hi @ChrispyP ,

 

Please add "{}" in Value to initialize object variable.

Expression reference:

addProperty(variables('Test'),'Email','Test@test.com')

Image reference:

7.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Super User
Super User

Re: Not working: Using addproperty() to write to an empty Object Variable

@ChrispyP 

So, this is all new to me but I did some playing around.  I think it's because the default value of your initialized variable is null, so there is nothing to add the properties to.

I added the dynamic value "Body" from the manual trigger and got the expected result. Maybe try that and see if that works.20190716b.PNG

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Community Support Team
Community Support Team

Re: Not working: Using addproperty() to write to an empty Object Variable

Hi @ChrispyP ,

 

Please add "{}" in Value to initialize object variable.

Expression reference:

addProperty(variables('Test'),'Email','Test@test.com')

Image reference:

7.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 54 members 4,762 guests
Please welcome our newest community members: