SplitOn property doesn't validate expression at design time
While working on a POC about Debatching in Logic Apps using SplitOn, I was encountered with an below error when tried to test the workflow
{
"error": {
"code": "InvalidTemplate",
"message": "The template language expression evaluation failed:
'The template language expression 'triggerBody()[‘PurchaseOrders’][‘PurchaseOrder’]' is not valid:
the string character '‘' at position '14' is not expected.'." } }
'The template language expression 'triggerBody()[‘PurchaseOrders’][‘PurchaseOrder’]' is not valid:
the string character '‘' at position '14' is not expected.'." } }
Why it happened
The error points out to the expression having invalid character in it at position 14 i.e. the single quote.
First thought was - if that is the case then Logic app designer should have stopped me from saving the workflow (Design time validation), but it did not.
And when request was posted to it, logic app runtime gave the error. Struggled a bit with resolving this and it happened to be a character encoding issue… Thanks to Manojkumar Sachdev for pointing it out.
The reason was I typed in the expression in Microsoft Word, copied it from there and pasted in code view. Saved the logic app and when started testing got the error.
First thought was - if that is the case then Logic app designer should have stopped me from saving the workflow (Design time validation), but it did not.
And when request was posted to it, logic app runtime gave the error. Struggled a bit with resolving this and it happened to be a character encoding issue… Thanks to Manojkumar Sachdev for pointing it out.
The reason was I typed in the expression in Microsoft Word, copied it from there and pasted in code view. Saved the logic app and when started testing got the error.
What to do
To resolve this issue, deleted the single quote which was copied from Microsoft word and typed in single quote directly in code view.
That’s it.. all working fine.
Still, wanted to know why Design time validation didn’t stop me from saving the workflow?
Tried to emulate it with Foreach loop, copied single quote from Microsoft word and added in expression and tried to save it - And I was not allowed, design time validation stopped me from doing it.
So it was clear that issue is only with SplitON property, so tried couple of things with it
1. Removed @ and added incorrect expression -- design time didn't allow me to save
Not sure if this is bug, or is this how splitOn is designed -- will try to reach out to Microsoft Product team and update if any answer received.
Let me know if you have some inputs on this in comments !!!
Comments
Post a Comment