SplitOn property doesn't validate expression at design time

{tocify} $title={Table of Contents}

Error/Issue



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
expression evaluation failed on splitOn property

                           



 { "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.'." } }


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.  


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.

replacing incorrect single quote with correct single quote

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.

reproducing error with foreach expression


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
without @



2. Kept @ and added incorrect expression -- design time didn't allow me to save

with @

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.


If you have questions or suggestions, feel free to do in comments section below !!!


Do share if you find this helpful .......
 
                         Knowledge Sharing is Caring !!!!!!


Learn More about Logic App


Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post