Azure Logic Apps – Inline Code

Recently in Build 2019, Azure Logic Apps announced many new features. Few of them are:

  • General Availability of Integration Service Environment – Dedicated Logic Apps environment in Azure that offers full isolation of Storage and Network, dedicated compute for predictable and consistent performance at a flat cost, auto scaling based on rules, etc.
  • Public preview of Inline Code – Write code directly in Logic Apps.
  • General Availability of SAP/ HANA connector – Bi directional integration with SAP, Push data from SAP to Logic Apps, Generate schemas for mapping
  • VSCode Integration (Coming soon) – Logic Apps local project support, Build support to generate ARM Templates, Azure DevOps YAML pipeline files to set up release, commit to deploy automatically.

I tried my hands at Inline code feature and I was super impressed.

First question that came to my mind was, would the Inline code feature completely handle any custom code requirement? Too early to say since this in preview mode and per Derek Li (Program Manager, Logic Apps product team), Inline code is designed when you want to write a few lines of code to do very simple tasks, e.g. RegEx parsing, arithmetic calculations. Functions and other solutions are still what you should use to do heavy lifting.

Secondly, you need Azure Integration Account to have Inline code on your Logic App currently. That could turn out to be super expensive for running a small piece of code. However, per Derek again, it will be available without IA as well soon. Great relief!

I created a Logic App to receive purchase order payload over HTTP and add a line delimiter at the end of each record. Actually, it was a requirement on my current project and I wrote a Function app for it. The ERPs were not able to add line delimiters to each record but we wanted record delimiters so we can do flat file schema parsing.

I was able to get this functionality working with this InlineCode feature. That was amazing!

Logic App workflow:


Input and Output via Postman App:



  • More languages support on the way: This is only going to get better from here. Logic Apps team is planning to add PowerShell and C# language support very soon.
  • Timeout: I tried to test the timeout functionality so I deliberately added a JavaScript function to delay throwing a response by 10 seconds. The action timed out in 5 seconds and I got an error saying the same. Therefore, your coding logic should not take more than 5 seconds to complete. However, this is Preview version not sure, if the max time will increase by the time it goes GA. TimeoutError

Limits: I do not find any specific documentation about the limitations to this action. This is a built-in action so I think the regular action throughput, concurrency and execution limitations apply to this.

Exception handling and debugging: We cannot step into the line of code to see variable values dynamically. Per Derek, “Currently either return the value, or if it fail to execute we will do our best to give you a meaningful err msg”. Moreover, it makes sense that the code you write here should not be complicated for setting breakpoints and debugging.

Would be interesting to see when C# support is added to try out “Try, Catch” method. On the other hand, I think the error message currently it throws should be sufficient for a small piece of code. E.g. “The inline code action ‘JavaScriptCode’ execution failed, with error ‘Invalid regular expression flags’.” ErrorInfo

This is indeed a great feature for many of us for requirements like the above ones that may not be met by Logic Apps Expressions but at the same time would not have to write a Function App separately and maintain it.

Thank you Logic Apps team!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s