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:
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!
Hi,
while creating HTML table for my data , i am facing the issue of running the flow for data operation ,
what i need to select in 'FROM' box
@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.
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...
So I need to convert it to an array... I tried select but no help either. 😭
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
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.
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.'.
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
As I use parse json, i got the error, my input content is:
Thus, I wrap it up with json,
But the error persists,
Am I using the correct formula?
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"}]
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,
Thank you so much for putting effort into reviewing my issue!
However, the error remains.
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.
Could this be the issue?
WarrenBelz
146,605
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,946
Most Valuable Professional