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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,915)