cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Highlighted
Super User II
Super User II

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.

View solution in original post

Highlighted
Community Support
Community Support

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.

View solution in original post

2 REPLIES 2
Highlighted
Super User II
Super User II

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.

View solution in original post

Highlighted
Community Support
Community Support

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.

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (7,891)