Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

The operation 'Initialize variable' can only be used at top level | Variable cannot be initialized in Logic App scope

{tocify} $title={Table of Contents}



Issue


While working on Logic App, I needed a local variable and tried to add it in Scope, however was presented with below warning








Why it happened


Logic app by design only supports Initialization of variables on Global Level(variables are global within an instance of Logic App execution). 

However we can use the variable at any stage of your process after initialization and perform following supported actions on it .








What to do

If you need to use variable, you can  initialize it outside Scope. 

Do not get confused with Top level in error, you can initialize it before and after scope. However if you plan to use it in scope, then it should be before Scope shape.


Feedback to Logic App product team

Like in BizTalk, where we can initialize a variable in scope (it's life is within scope), can we have same available in Logic app too?

i.e. Provision to have local variable in Logic App Scope?





Learn More about some more Logic App errors

  • The request has both SAS authentication scheme and 'Bearer' authorization scheme. Only one scheme should be used
  • Selected file must be between 1 and 2097152 bytes
  • SplitOn property doesn't validate expression at design time
  • The workflow with 'Response' action type should not have triggers with 'splitOn' property
  • The template language function 'xpath' expects its first parameter to be an XML object
  • The template language expression 'xxx' cannot be evaluated because property 'xxx' doesn't exist. Property selection is not supported on content of type 'application/xml'



This post first appeared on TechFindings, please read the originial post: here

Share the post

The operation 'Initialize variable' can only be used at top level | Variable cannot be initialized in Logic App scope

×

Subscribe to Techfindings

Get updates delivered right to your inbox!

Thank you for your subscription

×