Forum Discussion

rfortune's avatar
rfortune
Contributor
13 years ago

Cannot use XPath in Property Transfers

Hi guys,
I've come across this issue where I cannot use the xPath locator in the Property Transfer if I have used groovy/dynamic expansion in the destination request.

For instance - in if I want to transfer a GUID into the ReceiptId node in the following request I have to remove the groovy in the Date node before using the xpath helper to locate the Receipt ID node.

<Receipts>
<Receipt>
<ReceiptID></ReceiptID>
<User>
<UserID>${#randUserID}</UserID>
</User>
<Contact>
<Name>Legitimate Expenses Inc.</Name>
</Contact>
<Date>${= String.format('%tY-%<tm-%<td', new Date()) }<Date>
<Reference>REF-MOJO</Reference>
<LineAmountTypes>Inclusive</LineAmountTypes>
<LineItems>
<LineItem>
<Description>Nougat</Description>
<UnitAmount>4.15</UnitAmount>
<LineAmount>12.45</LineAmount>
<AccountCode>400</AccountCode>
<Quantity>3.0000</Quantity>
</LineItem>
</LineItems>
<Url></Url>
</Receipt>
</Receipts>


I get the following error when I try to find the node in the Property Transfer dialog screen:

Failed to select XPath for target property value [ ${#randUserID} Legitimate Expenses Inc. ${= String.format('%tY-%
REF-MOJO Inclusive Nougat 4.15 12.45 400 3.0000 ]


Note:Using dynamic expansion/groovy in requests also prevents the Format XML- Alt F functionality from working correctly.


UPDATE:
I've found a workaround, where I transfer the value into a Property step and then use proper property expansion to supply the ReceiptId (in this case). It's not pretty, but it works.
No RepliesBe the first to reply