How to access Application settings fields value from Logic app Standard workflow | Using Application settings as configuration store for Logic app standard workflow

{tocify} $title={Table of Contents}


Introduction


Most of the time, there is a need to have a configuration store where we can store key-value settings and consume stored settings from applications.

Same is true with Logic app as well, in few scenarios we do need to have such store.

Is there any way in Azure Logic App to create and use configurable values?

In case of Logic app consumption - there is no such provision. Following post shows an example about how to do it with help of Azure Table storage - Using Azure Storage Account Table as Config Store  for Logic Apps Consumption


However, in case of Logic app standard - there is a provision. We can make use of Application Settings under Configuration.

Let's see with an example


Scenario

Say, in the workflow you want to execute few steps which is based on a flag. 

But the flag value depends upon business team's advice. If it is set to yes then it is to be processed else not.

Here, for the sake of demo, we will send different responses based on flag value.

Let's look at the example

Create Solution 


First, we will add key/value pair in Application settings with key as ProcessFlag and value as True, followed by creating a workflow in which we read value of it.

Add ProcessFlag(key value pair) in Application Settings

Add ProcessFlag(key value pair) in Application Settings



Note: Any setting(key/value pair) in Application setting is available for all the workflows in Logic app.

Create a Logic app standard workflow to access flag value from Application settings

Add a new workflow in Logic App with http trigger, followed by Initialize variable action

Add Initialize variable action

Provide a name, type as string and against value provide following expression which uses appsetting template function
             
                                  appsetting('ProcessFlag')

This function does lookup in Application setting with the Key provided to it and returns the value which is set against it.

Add condition to check value of above variable at runtime

Add condition to check value of above variable at runtime

Processed Response


Set Response body as "Request Processed as Process flag is : @{variables('Value_AppSetting')}" when variable value is True

Unprocessed response


Set Response body as "Request is not Processed as Process flag is : @{variables('Value_AppSetting')}" when variable value is False


Testing

Any rest api client can be used to test it, here postman is used.

Copy the url from Overview page of workflow and use it for testing for following test cases.

1. When Process Flag is set to True in Application Settings

Output when process flag is set to True




2. When Process Flag is set to False in Application Settings

Output when Process Flag is set to False





Summary

With this post we saw that with Logic App Standard, there is a provision to store workflow specific settings/configurations in Application settings.

And how we can access/read it from workflow with the help of appsetting template function, also how the change in setting does not require any code changes in workflow.

It's good add on, which can help to control behavior of workflow from outside.


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