Interaction call returning 0 propositions when maxCount is set to 0008
This article addresses the issue where an interaction call returns 0 propositions when maxCount attribute is set to 0008 or more, modify the Interaction.js
library.
Description description
Environment
Adobe Campaign Classic
Issue/Symptoms
Interaction call returns 0 propositions when maxCount
attribute is set to 0008 or more than that in the SOAP payload.
In the below payload, the <urn:maxCount>00008</urn:maxCount>
tag takes a numeric value.
If you use a trailing 0, it works normally until 0007 (meaning 0000,0001,0002,…0007 work normally).
But if you use 0008 and above, it returns 0 propositions.
Interaction call payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:nms:interaction">
<soapenv:Header/>
<soapenv:Body>
<urn:Propose>
<urn:sessiontoken/>
<!--Recipient Id
<urn:targetId>random</urn:targetId>-->
<!-Account Id->
<urn:targetId>random</urn:targetId>
<!--Contact Id
<urn:targetId>random</urn:targetId>-->
<urn:maxCount>00008</urn:maxCount>
<urn:uuid/>
<urn:nlid/>
<urn:noProp/>
<urn:categories></urn:categories>
<urn:themes/>
<urn:context>
<!-You may enter ANY elements at this point->
<context>
<interaction onCallOfferFlg="Y" orgName="to be filled"/>
</context>
</urn:context>
</urn:Propose>
</soapenv:Body>
</soapenv:Envelope>
Endpoint:
https://<Server URL>/interaction/liveRcp/<offer>
Resolution resolution
Modify the Interaction.js
library and use:
var iAskedPropositionCount = parseInt(soapMethod.::maxCount.toString(),10);*
so that it works for all numbers.
Cause
On checking the Interaction.js
library, the parseInt()
function is used to parse the maxCount
value to Integer.
This parseInt()
function returns a decimal value by default.
var iAskedPropositionCount = parseInt(soapMethod.::maxCount.toString());*
This JS function inherits a property from C and C++ that if you pass a value in parseInt()
which starts with 0, it uses base-8 to return the value.
Since base-8 does not accept numeral greater than 7, when you pass 0008 or more, it converts it into 0 or NaN hence no proposition is returned.
If in maxCount
, you pass 8 instead of 0008, results in proposition in the response to the SOAP call.