cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bradt30h
Helper I
Helper I

Update Item SP Error - Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.

Hi All, This error keeps bugging me. Something is wrong with my expression.

When I try the expression separately using Compose action to test it, it works. (Expression shared below)

However, when I use it in SharePoint 'Update Item', it failed. Reason being:

Unable to process template language expressions in action 'Update_Status_after_approved_by_manager_or_partner' inputs at line '1' and column '3335':

'The template language expression <EXPRESSION> cannot be evaluated because property 'approverResponse' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details."

 

Basically, my expression is trying to populate the value of the first item and second item of the array (AllResponses) to my 'Approval History' column, with IF function to make it error-proof:

The expression below for pulling the first respondent result,

 

if(empty(variables('AllResponses')?[0]),'',
concat(
  If(equals(variables('AllResponses')?[0]?['approverResponse'],'Approve'),'‌‌ Approved by - ','‌‌ 
     Need more information by - '),
  variables('AllResponses')?[0]?['responder']?['displayName'],
  ', ',
  convertFromUtc(variables('AllResponses')?[0]?['responseDate'],'Singapore Standard Time','M/dd/yyyy h:mm:tt'),
  ': ',
  variables('AllResponses')?[0]?['comments']))

 

Result of my expression will be: 

bradt30h_0-1631714248675.png

 

Since the error stated: property 'approverResponse' cannot be selected.

Therefore, I tried to parse my variable('AllResponses') and notice that the item type for 'approverResponse' is string 

 

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "responder": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "displayName": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "tenantId": {
                        "type": "string"
                    },
                    "userPrincipalName": {
                        "type": "string"
                    }
                }
            },
            "requestDate": {
                "type": "string"
            },
            "responseDate": {
                "type": "string"
            },
            "approverResponse": {
                "type": "string"
            },
            "comments": {
                "type": "string"
            }
        },
        "required": [
            "responder",
            "requestDate",
            "responseDate",
            "approverResponse",
            "comments"
        ]
    }
}

 

Is this the reason why I wasn't able to call/select the JSON child? As the parent the has a different type

parent  = 'object'

child ie approverResponse = 'string'

 

I haven't been able to find a solution to handle this. Appreciate it so much if you can give me some clue!

Thanks for reading!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @bradt30h 

 

The error relates to your array being recognised as a string.  You can see from the screenshot that the array is displayed and recognised as a string because it is flat and not formatted. There must be a rogue character or missing bracket in your compose output.

 

can you screenshot the output from “show raw inputs” of the compose? Can you also copy and paste the array/string from that same window? 

Damien

View solution in original post

bradt30h
Helper I
Helper I

@DamoBird365 !!! I solved it!!! oh my god thanks so much for pointing me to the right direction!

I used this formula to convert it to correct Array.

json(replace(outputs('Compose'),'\',''))

I can't express how helpful you are... Once again thanks so much Damien. 

Please keep up your YT content, appreciate I could learn from you.

View solution in original post

14 REPLIES 14
DAllen365
Resolver III
Resolver III

It would be very helpful to see your flow.  Depending on how your actions are grouped (in a for each loop, inside a scope, a do-until), you may not be able to access the output of those actions.  Did you try leaving the Compose and putting the output of that into your Update item?  What column type are you trying to paste it into?


----------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

I have no clue how to debug this...

Hi DAllen,

This is my testing, my expression is fine.

bradt30h_0-1631325005580.png

This is the actual flow, trigger when new SP list created, multiple variables to store value for later and select to store array. Then, I use do until as I am creating State Machine Approval Workflows.

bradt30h_1-1631325153968.png

bradt30h_2-1631325311165.png

bradt30h_3-1631325349052.png

This is the part where the issue came in if I am using that similar expression in my testing above. I used it in the approval history SP column. The Approval History Column is multiple lines of text.

bradt30h_4-1631325393476.png

 

Here is the failed image:

bradt30h_6-1631325497687.png

Sorry, the flow is a little bit lengthy. Let me know if you can't see clearly 🙂 Thanks!

bradt30h
Helper I
Helper I

Bump

DamoBird365
Super User
Super User

Hi @bradt30h 

 

I appreciate you reaching out on my YT, albeit it's removed the message bizarrely, I can see it in my email 😉

 

I note you have the expression working in a compose, in the first instance, can you insert that into your main flow (in the yes branch) and insert it prior to the action that is failing (this is our attempt to debug).  You might have to insert below the failing action and then drag the update status below the compose.  Then run the flow and report back with details on the compose output (image of the history).

 

The next step, which I think has been suggested is to then use the compose in your update status action (if it works) and then if all of that works we try and understand why it's failing when typed directly into the update status action.  

 

I've looked at your expression and it seems valid and there is no reason why you shouldn't be able to select the string from the array that I can see.

 

It might also be useful to get a copy of the array history output, as I could load that into a compose and attempt the same thing - something to try later on if you are still stuck.

 

Damien

Hi Damien, 

 

Thank you so much for putting effort into reviewing my issue! 

 

However, the error remains. 

bradt30h_1-1631774867319.png

 

I also tried to parse JSON earlier, but fail as well. Notice the Json array being covered with [ ] and turn my variable into string, as below. 

 

bradt30h_0-1631773950663.png

Could this be the issue?

DamoBird365
Super User
Super User

Hi @bradt30h 

 

I would agree that it's your array that is at fault.  I am guessing that in your test, you copied the array?  But with your live, you are appending?  Can you copy and paste the output of the append to array variable in full?  The very fact that the parse json is escaping values, means that it too is treating the whole value supplied as input as a string.  I don't use variables myself personally, more of a compose fan but I would have thought that a variable of type array would error first. 

 

You can wrap a string in json() to remove escaped characters but I think it would be worth seeing the output as a copy/paste of the text, rather than image, so that it can be looked at in a beautifier.  Something you see in my video 😉

 

Damien

Hi Damien,

You are absolutely right, I copied the array in my test.

The reason I use the variable is to consolidate multiple "start and approval" actions responses (multiple approvals for error handling purposes).

 

This is the output from the Append array variable:

[{"responder":{"id":"22584fd1-0b70-481b-b5c6-59070aedf863","displayName":"Bradley Teoh","email":"bradleytest@gmail.com","tenantId":"5b973f99-77df-4beb-b27d-aa0c70b8482c","userPrincipalName":"bradleytest@gmail.com"},"requestDate":"2021-09-16T06:43:38Z","responseDate":"2021-09-16T06:44:33Z","approverResponse":"Approve","comments":"well done"}]

As I use parse json, i got the error, my input content is:

[
  "[{\"responder\":{\"id\":\"22584fd1-0b70-481b-b5c6-59070aedf863\",\"displayName\":\"Bradley Teoh\",\"email\":\"bradleytest@gmail.com\",\"tenantId\":\"5b973f99-77df-4beb-b27d-aa0c70b8482c\",\"userPrincipalName\":\"bradleytest@gmail.com\"},\"requestDate\":\"2021-09-16T07:35:48Z\",\"responseDate\":\"2021-09-16T07:3...\"}]"
]

bradt30h_0-1631778067106.png

Thus, I wrap it up with json, 

bradt30h_2-1631778356197.png

But the error persists,

bradt30h_1-1631778177495.png

Am I using the correct formula?

DamoBird365
Super User
Super User

Hi @bradt30h 


An observation at my end is that if I paste your sample array into a variable array, it parses ok, the history output is neatly formatted/beautified and your if expression works fine from a compose. I’ve tried this myself.

 

looking at your screenshots, the history of the array is not formatted correctly.  I don’t grasp what you are doing with your append array action. A select would allow you to select the keys values from the responses and if you have two approvals, potentially union would help you bring those two arrays together. I can’t help but think you’ve created an odd array. Very hard for me to diagnose.

 

 You need to walk through the history and check to see where the format goes wrong.

 

Damien

bradt30h
Helper I
Helper I

Hi @DamoBird365,

 

My approval flow works depending on what is the value selected by User who submit the form. I have 3 types of option, so each option will have different content being populated in Approval for reviewer to approve. Theoritically, I have 3 approval, but I also built error-proof approval below that (as there is limit in Approval attachment). Hence, I have 6 Approval. 

No matter what, in the end, there is only one approval outcome, depending on which type of approval User submitted. Thus, I tried to consolidate everything into one variable. 

 

Now, I tried Union, but out of the 6 approval responses, only 1 has content, the Union fail as the other responses return value are being empty. 

 

I also tried, compose to consolidate the data instead of Append Array. Fortunately, the array remain array.

bradt30h_0-1631853486329.png

But later when writing into SP, an error comes again. 😢

InvalidTemplate. Unable to process template language expressions in action 'Update_Status_after_approved_by_manager_or_partner' inputs at line '1' and column '3336': 'The template language expression

'if(empty(outputs('Compose')?[0]),'', concat(If(equals(outputs('Compose')?[0]?['approverResponse'],'Approve'),' Approved by - ',' Need more information by - '), outputs('Compose')?[0]?['responder']?['displayName'],', ', convertFromUtc(outputs('Compose')?[0]?['responseDate'],'Singapore Standard Time','M/dd/yyyy h:mm:tt'),': ', outputs('Compose')?[0]?['comments']))'

cannot be evaluated because property '0' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.

bradt30h_1-1631853537926.png

Hi @bradt30h 

 

The error relates to your array being recognised as a string.  You can see from the screenshot that the array is displayed and recognised as a string because it is flat and not formatted. There must be a rogue character or missing bracket in your compose output.

 

can you screenshot the output from “show raw inputs” of the compose? Can you also copy and paste the array/string from that same window? 

Damien

View solution in original post

Hey Damien,

Wao, interesting, outside it shows like array when showing raw input, It is a string...

To me, this seems like a bug, when I stacked all the responses into one...

bradt30h_0-1631870312802.png

"[{\"responder\":{\"id\":\"22584fd1-0b70-481b-b5c6-59070aedf863\",\"displayName\":\"Bradley Teoh\",\"email\":\"bradleytest@gmail.com\",\"tenantId\":\"5b973f99-77df-4beb-b27d-aa0c70b8482c\",\"userPrincipalName\":\"bradleytest@gmail.com\"},\"requestDate\":\"2021-09-17T09:14:25Z\",\"responseDate\":\"2021-09-17T09:14:58Z\",\"approverResponse\":\"Approve\",\"comments\":\"soso\"}]"

 

So I need to convert it to an array... I tried select but no help either. 😭

bradt30h_2-1631870680867.png

 

bradt30h_1-1631870489864.png

 

bradt30h
Helper I
Helper I

@DamoBird365 !!! I solved it!!! oh my god thanks so much for pointing me to the right direction!

I used this formula to convert it to correct Array.

json(replace(outputs('Compose'),'\',''))

I can't express how helpful you are... Once again thanks so much Damien. 

Please keep up your YT content, appreciate I could learn from you.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Users online (3,028)