I want to extract employee number from astring. The string format will be
123456@abc.com
I want to extract number before the '@' . characters after '@' may vary for employees and is not same for all employees
I am using EV policy and storing username in variable, and username will have value:123456@abc.com
<JSONPayload> <Variable name="username"> <JSONPath>username</JSONPath> </Variable> </JSONPayload>
Solved! Go to Solution.
That won't work... The 2nd Variable element will not work as you might expect. I believe there is a bug there, or at the least it is a surprising behavior. A single ExtractVariables policy is not able to first extract a value from a payload, and then extract a value from the variable that was just set. You can do what you want if you separate those steps into 2 distinct EV policies....
policy1
<ExtractVariables name='EV-from-JSON-Payload-1'> <Source>contrivedIntrospectionResponse</Source> <VariablePrefix>extracted</VariablePrefix> <JSONPayload> <Variable name='username'> <JSONPath>$.username</JSONPath> </Variable> </JSONPayload> <!-- this won't work --> <Variable name="extracted.username"> <Pattern>{empid}@**</Pattern> </Variable> <!-- this also won't work --> <Variable name="username"> <Pattern>{empid2}@**</Pattern> </Variable> </ExtractVariables>
policy2
<ExtractVariables name='EV-from-Variable'> <VariablePrefix>extracted</VariablePrefix> <Variable name="extracted.username"> <Pattern>{empid2}@**</Pattern> </Variable> </ExtractVariables>