Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Not able to get json variable values in assign Message policy from Extract policy,I am not able to assign json o/p in Assign Message policy after applying Extract Policy

Not applicable

HI,

I am using Extract policy to extract the json request and need to assign using Assign message policy , but getting blank json o/p as below :

{
  "comment" :"",
  "jokeid" : "",
  "commentor" : ""
}

My Extract policy o/p is displaying correct as below :

{
"comment" :"XXXX",
"jokeid" :3112,
"commentor":"YYYYY"
}

I need to assign this o/p using Assign Message Policy but getting blank values as shown above.

Extract Policy Code :

<ExtractVariables name="Extract-Comments">
  <DisplayName>Extract Comments Post</DisplayName>
  <Properties/>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
  <JSONPayload>
    <Variable name="comment">
      <JSONPath>$.comment</JSONPath>
    </Variable>
    <Variable name="commentor">
      <JSONPath>$.commentor</JSONPath>
    </Variable>
    <Variable name="jokeid">
      <JSONPath>$.jokeid</JSONPath>
    </Variable>
  </JSONPayload>
  <Source clearPayload="false">request</Source>
</ExtractVariables>

Assign Message policy code :

<AssignMessage name="Assign-Comments">
  <DisplayName>Assign Comments</DisplayName>
  <Set>
    <Payload contentType="application/json">{
      "comment" :"{comment}",
      "jokeid" : "{jokeid}",
      "commentor" : "{commentor}"
}
</Payload>
    </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

Please suggest.

============================================================================

1 14 1,740
14 REPLIES 14
Top Solution Authors