hello, I have the below policy which is accessing a variable. I am trying to use the substring function in the policy to take the first 5 charters of the string and forward it in the header. For whatever reason substring seems to be doing nothing. Any ideas on why this is? to lower works just fine, but I can't seem to figure out substring. Thanks.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><AssignMessage async="false" continueOnError="false" enabled="true" name="forward-user-info">
<DisplayName>forward-user-info</DisplayName>
<Set>
<Headers>
<Header name="x-app-name">{substring(dev.app-name,0,4)}</Header>
</Headers>
</Set>
</AssignMessage>
Solved! Go to Solution.
Try it with IgnoreUnresolvedVariables = true.
<AssignMessage name='AM-Substring'> <DisplayName>AM-Substring</DisplayName> <!-- this element is important because Apigee attempts to treat the 0 and 4 as variables, which will be unresolved. :( But we just want them to be numbers. --> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignVariable> <Name>assigned</Name> <Template>{substring(alphabet,0,4)}</Template> </AssignVariable> </AssignMessage>