Skip to content

Dictionary Contains Key

Type: dict-contains-key  ·  Package: Collections Activities v1.0.3  ·  Output: bool

Checks whether a dictionary contains a key and returns true/false. Use it before reading a value with Get Dictionary Value, which fails if the key does not exist.

Checks whether the key exists in dict. The key is converted to text before looking it up. In dictionaries created with Create Dictionary or newDict(), keys are case-sensitive ("Total" and "total" are different keys). It does not modify the dictionary.

ParameterTypeDefaultDescription
dictDictionary—The dictionary.
keystring—The key to check.

None.

Returns a bool: true if the key exists (even if its value is null), false otherwise.

MessageCause and fix
'dict' must be a Dictionary, got ….dict is not a dictionary (the message shows the type received, or null if the variable is empty). Create it first with Create Dictionary.
'key' cannot be null.The key expression returned null.

Fill in a default value when it is missing from the configuration:

Dictionary Contains Key dict = config key = "timeout" → output: hasIt
If condition = !hasIt
└─ then:
Set Dictionary Value dict = config key = "timeout" value = 30000 // default value