Introduction
Here's a very simple example of such - I have an integration that processes product returns. The trigger request payload is as follows -
Now I need to add support for possible extra fields such as product.I've clicked Allow Dynamic JSON and have defined the response as follows - Let's misuse the status field and fill it with the product value.
Here I need to edit the XSLT in the Mapper. First, let's map the orderNr to status -
Check out the XSLT -<ns14:status>
<xsl:value-of select="/nstrgmpr:execute/ns14:request-wrapper/ns14:details/ns14:orderNr"/>
</ns14:status>
</ns14:response-wrapper>
Now I edit the value-of as follows -
<ns14:status>
<xsl:value-of select="/nstrgmpr:execute/ns14:request-wrapper/ns14:details/*[local-name()='product']"/>
</ns14:status>
</ns14:response-wrapper>
Note the format I need to use. Now let's try this in a Switch action. I need to log the product value, if it is present.
Here I use - string-length(/ns13:execute/ns10:request-wrapper/ns10:details/*[(local-name() = 'product')]) > 0The Logger action is configured as follows -
Let's run the integration - run with no product field -

No comments:
Post a Comment