cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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.

View solution in original post

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.

View solution in original post

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.

View solution in original post

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.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 170 members 5,144 guests
Please welcome our newest community members: