---
title: Message Context Key Plugin – Return the Value of a Context Property by Key
description: Use the Nodinite Message Context Key Search Field Expression plugin to return the value of one context property, looked up by its exact key, with no pattern or parsing.
---

# <i class="fal fa-magnifying-glass" aria-hidden="true"></i> Message Context Key Search Field Expression Plugin

The **Message Context Key** plugin returns the value of one context property of a [Log Event][], looked up by its **exact key**. There's no pattern and no parsing: the whole value becomes the [Search Field][Search Fields] value. Use it when a context property already holds exactly the value you want, such as an order number or a file name set by the sender.

* ✅ Simplest way to read a context value: enter the key, get the value  
* ✅ Reads only the context properties; the message body is never read  

![Message Context Key returns Northwind Traders from the CustomerName context key, animated walkthrough (7.12)][4]  
*Animated walkthrough: the key `CustomerName` on the context of a logged Order-to-Cash order confirmation returns the value `Northwind Traders`, as it is.*  

## <i class="fal fa-scale-balanced" aria-hidden="true"></i> When to use it

Message Context Key and the four [RegEx][] plugins cover the combinations of *where the text is* and *what part of it you want*. For every plugin, see [Choose a plugin][].

| Your data | You want | Use |
| --- | --- | --- |
| One context value (you know the key) | The value as it is, no pattern | **Message Context Key** (this page) |
| One context value (you know the key) | The whole match of a pattern | [RegEx on Message Context][] |
| One context value (you know the key) | Only the part inside a capturing group `( )` | [RegEx on Message Context with capturing groups][] |
| XML stored in a context value | An XPath result | [XPath on Message Context][] |
| Message body | The whole match of a pattern | [RegEx][] |
| Message body | Only the part inside a capturing group | [RegEx with capturing groups][] |
| Several keys that match a pattern | Their values | [Formula][] with [`context(regex('…'))`][Formula context] |

## <i class="fal fa-code" aria-hidden="true"></i> Expression syntax

Select **Message Context Key** in the **Type** list and enter the key in the **Expression** field.

![Type list open with the Expression Types, among them Message Context Key (7.12)][1]  
*The Message Context Key plugin in the Type list.*  

* The **Expression** is the key itself, not a pattern. Write it exactly as it's logged: the key is case-sensitive, so `customername` doesn't find `CustomerName`.
* The whole value is returned as it is, for example a full file path.
* [BizTalk][BizTalk Logging] context properties are logged as *namespace#property*, for example `http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName`.
* Context properties and the reserved keys are described in [Context Options][]. Properties that the [ContextPropertiesFilters][] [System Parameter][System Parameters] removes aren't kept, so don't base a [Search Field][Search Fields] on them.
* To test, add the key and its value on the **Message Context** tab of Test Expression. When the key is missing, the test reports *Processed with warning: The Expression yields no result*:

![Test Expression result: Processed with warning, The Expression yields no result (7.12)][3]  
*Test result when the key isn't among the context properties.*  

Configure and test the expression as described in [Add or manage Search Field][] and [Test Your Expression][].

## <i class="fal fa-list-ol" aria-hidden="true"></i> Examples

### Example 1: Return the value of a custom context key

#### Input

| Key | Value |
| --- | --- |
| `ProductOfTheYear` | `Nodinite` |

#### Expression

```text
ProductOfTheYear
```

#### Result

```text
Nodinite
```

![Test Expression for Message Context Key returning Nodinite from the ProductOfTheYear context key (7.12)][2]  
*Test Expression: the value of `ProductOfTheYear` from the Message Context tab.*  

### Example 2: Return the full path of the file that BizTalk received

#### Input

| Key | Value |
| --- | --- |
| `http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName` | `C:\Integration\In\Orders\PO_4711.xml` |

#### Expression

```text
http://schemas.microsoft.com/BizTalk/2003/file-properties#ReceivedFileName
```

#### Result

```text
C:\Integration\In\Orders\PO_4711.xml
```

To keep only the file name `PO_4711.xml`, use [RegEx on Message Context][] with `([^\\]+$)`.

![Message Context Key test: the BizTalk ReceivedFileName key returns the full file path (7.12)][5]  
*The full `namespace#property` key returns the logged value as it is.*  

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-plus" aria-hidden="true"></i> [Add or manage Search Field][]  
* <i class="fal fa-flask" aria-hidden="true"></i> [Test Your Expression][]  
* <i class="fal fa-signs-post" aria-hidden="true"></i> [Choose a plugin][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-magnifying-glass" aria-hidden="true"></i> [RegEx on Message Context][]  
* <i class="fal fa-magnifying-glass" aria-hidden="true"></i> [RegEx on Message Context with capturing groups][]  
* <i class="fal fa-magnifying-glass" aria-hidden="true"></i> [XPath on Message Context][]  
* <i class="fal fa-magnifying-glass" aria-hidden="true"></i> [RegEx][]  
* <i class="fal fa-magnifying-glass" aria-hidden="true"></i> [RegEx with capturing groups][]  
* <i class="fal fa-function" aria-hidden="true"></i> [Formula][]  
* <i class="fal fa-function" aria-hidden="true"></i> [Formula context][]  
* <i class="fal fa-filter" aria-hidden="true"></i> [ContextPropertiesFilters][]  
* <i class="fal fa-magnifying-glass-plus" aria-hidden="true"></i> [Search Field Expressions][]  
* <i class="fal fa-magnifying-glass-plus" aria-hidden="true"></i> [Search Fields][]  

[1]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Message%20Context%20Key/Select.png
[2]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Message%20Context%20Key/Example1.png
[3]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/NoResult.png
[4]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Expression_ContextKey.gif
[5]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Message%20Context%20Key/Example2.png

[Add or manage Search Field]:https://docs.nodinite.com/administration/log-management/search-fields/features/add-or-manage-search-field/
[BizTalk Logging]:https://docs.nodinite.com/logging-and-monitoring/microsoft-biztalk-server-logging/overview/
[Choose a plugin]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/overview/#fa-signs-post-choose-a-plugin
[Context Options]:https://docs.nodinite.com/core-services/log-event/features/context-options/
[ContextPropertiesFilters]:https://docs.nodinite.com/administration/settings/system-parameters/contextpropertiesfilters/
[Formula]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/overview/
[Formula context]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/source/context/
[Log Event]:https://docs.nodinite.com/core-services/log-event/overview/
[RegEx]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/regex/
[RegEx on Message Context]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/regex-on-message-context/
[RegEx on Message Context with capturing groups]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/regex-on-message-context-with-capturing-groups/
[RegEx with capturing groups]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/regex-with-capturing-groups/
[Search Field Expressions]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/overview/
[Search Fields]:https://docs.nodinite.com/administration/log-management/search-fields/features/what-is-a-search-field/
[System Parameters]:https://docs.nodinite.com/administration/settings/system-parameters/overview/
[Test Your Expression]:https://docs.nodinite.com/administration/log-management/search-fields/features/add-or-manage-search-field/#test-your-expression
[XPath on Message Context]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/xpath-on-message-context/