Key Value Map Operations Policy doesn't load Environment Configuration Key Value Maps

Not applicable

I've done a lot of searches but haven't found any solution for why Key Value Map Operations Policy fails to load a Key Value Map defined through the Mangement UI in Environment Configuration.

Here's how I'm defining my policy:

<KeyValueMapOperations name="Config-Key-Value-Map-Operations" mapIdentifier="name-of-key-value-map-in-env-config">
  <DisplayName>Config Key Value Map Operations</DisplayName>
  <Properties/>
  <ExclusiveCache>false</ExclusiveCache>
  <ExpiryTimeInSecs>300</ExpiryTimeInSecs>
  <Scope>environment</Scope>
  <Get assignTo="keyName" index="1">
    <Key> <Parameter ref="keyName"/> </Key>
  </Get>
</KeyValueMapOperations>

When I look in the trace, there are variables defined for keyName but the values are empty strings, not the values defined in the Environment Configuration Key Value Map.

Solved Solved
0 6 269
1 ACCEPTED SOLUTION

Not applicable

Organization name is "dev". However changing to <Parameter>something</Parameter> fixed it. It's working now. Thanks!

View solution in original post

6 REPLIES 6

HI @Donald Collett

  1. Can you confirm you created the KVM in the environment where the proxy is deployed ?
  2. Can you confirm if reference variable in <Parameter> has a value that matches the key you have within the KVM ?
  3. Are you using the same variable names for Parameter and assignTo (its in the snippet you pasted) ? Can you change that to a different variable name ?

Can you try changing the Parameter from using the ref to use the actual key string itself to check if its working ?? For example, lets say your key in the KVM is "something", then change your policy to

<Get assignTo="foo_variable" index="1">
    <Key>
      <Parameter>something</Parameter>
    </Key>
</Get>

  1. Confirm they are in the same organization and environment.
  2. Confirm that the <Parameter> reference matches the keys in the KVM.
  3. Was using the same name for Parameters and assignTo. Changed them to be different.

The assignTo names in the environment are still null after the Key Value Map Operations policy has been processed. Verified using a Javascript policy.

Thanks for the info @Donald Collett

Can you please provide your org name ?

Also did you try the last note I mentioned ? Instead of using the ref in the Parameter, hardcode the key name and see if that works ?

The assignTo names in the environment are still null

This means the KVM does not hold the key that you think it does. I suggest that you re-check your assumptions.

One note: your phrasing "the assignTo names in the environment..." is odd. The behavior of the KVM-Get policy is to assign to the variable specified in the assignTo attribute. That variable does not exist "in the environment" but rather it is assigned within the context of a single request. After the request completes, the variable disappears. The KVM store persists in the environment. I just wanna make sure you understand what is expected to happen, in case you are unclear about the behavior of KVM. Repeat: The KVM Get policy does not set variables "in an environment."

ALSO: be aware that if RIGHT NOW you read the KVM and get an empty value, then modify the policy and run it again, within 5 minutes.... the result of the prior KVM read has been cached. You may see the prior (empty?) value again, until the cache expires. You have set the cache TTL to 300 seconds. MAke sure you're not getting misled by the cache.

Not applicable

Organization name is "dev". However changing to <Parameter>something</Parameter> fixed it. It's working now. Thanks!

Thanks for the confirmation.

Just for future readers, the configuration as used originally is just fine:

 <Get assignTo="output_variable" index="1">
    <Key>
      <Parameter ref='variableNameHere'/>
    </Key>
</Get>

The key thing is that 'variableNameHere' just hold a valid value before execution of the policy.