cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ecrevisse
Helper II
Helper II

Question mark in workflow()

hi,

 

i have little question. 

Could someone explain why some expressions contain a question mark in them ?

 

concat('https://us.flow.microsoft.com/manage/environments/',workflow()?['tags']?['environmentName'],'/flows/',workflow()?['name'],'/runs/',workflow()?['run']['name'])
 
Damian
3 ACCEPTED SOLUTIONS

Accepted Solutions
CFernandes
Super User
Super User

Hey @ecrevisse 

 

The navigation is done by the ?[‘propertyName’] string added to the source reference expression.

 

For example, to process the output body Power Automate will take output from workflow()?‘['tags]’, and access the property “environmentName”.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

 

 

 

 

View solution in original post

efialttes
Super User
Super User

Hi!
That's a great question, IMO!
Let's take the following example: 

 

workflow()?['tags']

 

This means 'workflow()' output is an object with one or more attributes, one of them is 'tags'. So by adding a question mark in the middle you are pointing out the fact that 'tags' attribute is optional: in theory you can find 'workflow()' outputs with 'tags' attribute declared; and 'workflow()' outputs with 'tags' attribute undeclared. In the latter case, workflow()?['tags']  expression output will be null.

However, if you use the following example:

 

workflow()['tags']

 

 Now we haven't added a question mark in the middle, meaning that we expect 'tags' attribute to be mandatory. The whole workflow()['tags'] expression will throw an error if 'workflow()' outputs have 'tags' attribute undeclared.

You can find a more academic explanation here, please check question mark operator definition: "To reference null properties in an object without a runtime error, use the question mark operator"


Hope this makes sense



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!



View solution in original post

ecrevisse
Helper II
Helper II

Huge thanks ! 🙂 

View solution in original post

3 REPLIES 3
CFernandes
Super User
Super User

Hey @ecrevisse 

 

The navigation is done by the ?[‘propertyName’] string added to the source reference expression.

 

For example, to process the output body Power Automate will take output from workflow()?‘['tags]’, and access the property “environmentName”.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

 

 

 

 

efialttes
Super User
Super User

Hi!
That's a great question, IMO!
Let's take the following example: 

 

workflow()?['tags']

 

This means 'workflow()' output is an object with one or more attributes, one of them is 'tags'. So by adding a question mark in the middle you are pointing out the fact that 'tags' attribute is optional: in theory you can find 'workflow()' outputs with 'tags' attribute declared; and 'workflow()' outputs with 'tags' attribute undeclared. In the latter case, workflow()?['tags']  expression output will be null.

However, if you use the following example:

 

workflow()['tags']

 

 Now we haven't added a question mark in the middle, meaning that we expect 'tags' attribute to be mandatory. The whole workflow()['tags'] expression will throw an error if 'workflow()' outputs have 'tags' attribute undeclared.

You can find a more academic explanation here, please check question mark operator definition: "To reference null properties in an object without a runtime error, use the question mark operator"


Hope this makes sense



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!



ecrevisse
Helper II
Helper II

Huge thanks ! 🙂 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (1,782)