Looking for old forum posts and information? View the old forum archive here ยป
Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

A static copy of our previous forums website is available online for reference. Click here to access the forum archive.

Learn more about...


DIsplay <a> in XMLPackage based on call param from Order.cs

I am trying to put a link in customer receipt that only shows is an administrator is displaying the receipt. Without conditional logic, it works fine (anyone can use it). Since notification.receipt.xml.config is created in Order.cs, I'm adding an additional param to the call (UserIsAdmin='true') as below:

        var kboAdminStatus = ViewingCustomer.IsAdminUser ? "&UserIsAdmin=true" : "";
        String PackageName = AppLogic.AppConfig("XmlPackage.OrderReceipt");
        String result = AppLogic.RunXmlPackage(PackageName, null, ViewingCustomer, SkinID, String.Empty, "ordernumber=" + OrderNumber.ToString() + kboAdminStatus, false, true);

in notification.receipt.xml.config I've added the variable kboUserIsAdmin

	<xsl:variable name="kboUserIsAdmin" select="/root/QueryString/UserIsAdmin" />

I set an if conditiontion to control the creation of the <a> link, which at this point never displays.

                <xsl:if test="$kboUserIsAdmin = true()">
                    <td class="kboOrderAnalysis">
                      <!--Order Analysis Download-->
                        <xsl:attribute name="href">
                          <xsl:value-of select="concat('kbo_Download_OrderCost.aspx?OrderNumber=', $OrderInfo/OrderNumber)" disable-output-escaping="yes" />
                        _Upload Order Cost

I don't seem to be able to get the variable passed into the XMLPackage. What am I doing wrong?




asked Jan 26, 2015 in ML by AbbottF (360 points)

2 Answers

0 votes
Put your XMLPackage in debug mode and verify that the IsAdmin data node is both present and in a child of the node you are selecting for the variable.

I suspect that either the node structure you're referencing is off, the value of the variable you are referencing does not evaluate the way your subsequent code expects, or the node is missing altogether.
answered Jan 29, 2015 by Chris (3,685 points)
edited Jan 29, 2015 by Chris
0 votes

Definitely put the XML package into debug mode to see what values it's receiving in the Query string.

My guess is that it's getting confused between the text value 'true' and the XSLT value of true(). To simplify this, I'd suggest trying:

var kboAdminStatus = ViewingCustomer.IsAdminUser ? "&UserIsAdmin=1" : "";

and then...

<xsl:if test="$kboUserIsAdmin = 1">


answered Feb 16, 2015 by Webopius (650 points)