cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lfinman
Level: Powered On

Using variable type 'object' in Flow

I have a Flow, triggered from D365, creates a 'connection' between two entities.  To do this, I have a variable opportunityPartner, type: object, initial value: null().    I set the variable in my Flow:

Set opportunityPartner.jpg

but when the Flow executes, it fails with a complaint that I am trying to assign a string to variable of type object:
set opportunityPartner error.jpg
  Why does it not treat 'accountid' as an object, and what do I need to do?
 
Thanks!
Lyn
1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Level 10

Re: Using variable type 'object' in Flow

Hello @lfinman 

Here is an example of Compose:

 

pic1.png

 

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 

View solution in original post

6 REPLIES 6
Dual Super User
Dual Super User

Re: Using variable type 'object' in Flow

Hi
Sounds really weird..
To inspect its current content I suggest to initialize temporarily your variable as string, add a terminate action block, restar the failed flow execution and inspect the output
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Jcook
Level 10

Re: Using variable type 'object' in Flow

Hello @lfinman

In D365 if you are only getting one value, and not a list of values. It is considered a String.

I have done many flows that use D365 / CDS.
I always use a Compose Shape instead of a Variable.

The only time I use a Variable is if the value is a constant.

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
lfinman
Level: Powered On

Re: Using variable type 'object' in Flow

That sounds promising @Jcook , thanks.  Do you happen to have an example of using a Compose Shape to handle a D365/CDS object in Flow?  I'm a newbie.

Jcook
Level 10

Re: Using variable type 'object' in Flow

Yes I can post a picture when I get to my computer,

However it is very simple. Just treat the Compose shape as the Variable.

All you have to do is Add an action. Search for Compose, this action is under Data Operations.
Now in the input for the Compose, just do exactly as you are doing in your Variable.

I can post a few pictures in a bit if you need some help.

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
Jcook
Level 10

Re: Using variable type 'object' in Flow

Hello @lfinman 

Here is an example of Compose:

 

pic1.png

 

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

 

View solution in original post

lfinman
Level: Powered On

Re: Using variable type 'object' in Flow

Temendous, @Jcook , that solved it for me.  I'm sure it will come in handy many times over.  Thanks for your time!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,025)