Exporting Text Format Positive Pay File in Dynamics 365 for Finance and Operations

By Laura Lake | May 29, 2018

In Dynamics 365 for Finance and Operations, the default format of the Positive Pay output is XML. Microsoft has provided steps for the setup of Positive Pay as well as a sample XSLT file used to transform the output.

However, it is possible to create your own XSLT file for text or CSV format. The following sample code creates a fixed length text file but could be modified easily for CSV format. Note the output method highlighted below. Here is a link to the string manipulation functions used in the sample.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl xslthelper" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xslthelper="http://schemas.microsoft.com/BizTalk/2003/xslthelper">
  <xsl:output method="text" omit-xml-declaration="yes" indent="yes"/>
  <xsl:template match="/">
      <xsl:for-each select="Document/BankPositivePayExportEntity">
        <!--Cheque Detail begin-->
        <xsl:value-of select='string("C02800")'/> 
        <xsl:value-of select="substring(concat(ACCOUNTNUM/text(),'          '),1,10)"/>
        <xsl:choose>
          <xsl:when test='CHEQUESTATUS/text()=normalize-space("Void") or CHEQUESTATUS/text()=normalize-space("Rejected") or CHEQUESTATUS/text()=normalize-space("Cancelled")'>
            <xsl:value-of select='string(" VD ")'/>
          </xsl:when>
          <xsl:when test='CHEQUESTATUS/text()=normalize-space("Payment")'>
            <xsl:value-of select='string(" RA ")'/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select='string("    ")'/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:variable name="cknumpadded" select="concat('0000000000',normalize-space(CHEQUENUM/text()))"/>
<xsl:value-of select="substring($cknumpadded, string-length($cknumpadded) - 10 + 1, 10)" />
<xsl:variable name="amtdec" select="substring-after(AMOUNTCUR/text(), '.')" />
<xsl:variable name="amtval" select="substring-before(AMOUNTCUR/text(), '.')" />
<xsl:variable name="amtpadding" select="concat('00000000', $amtval)" />
<xsl:variable name="amtpadded" select="substring($amtpadding, string-length($amtpadding) - 8 + 1, 8)" />
<xsl:value-of select="concat($amtpadded,'V',substring($amtdec,1,2))" />
<xsl:variable name="year" select="substring(TRANSDATE/text(),3,2)" />
<xsl:variable name="month" select="substring(TRANSDATE/text(),6,2)" />
<xsl:variable name="day" select="substring(TRANSDATE/text(),9,2)" />
<xsl:value-of select="concat($month,$day,$year)" />
        <xsl:value-of select='string("                    ")'/>
<xsl:variable name="blk128" select='string("                                                                                                                               ")'/>
        <xsl:value-of select="substring(concat(BANKNEGINSTRECIPIENTNAME/text(),$blk128),1,128)"/>
        <xsl:text>&#13;&#10;</xsl:text>
      </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

It is important to note that when generating the Positive Pay file and the Open or Save prompt appears, you must change the file type to Txt. See the following screenshots.

1. Upload the transformation file as per the instructions in the link at the beginning of this article.

Exporting text format Positive Pay file

2. Generate Positive Pay

Positive Pay file in Dynamics 365 for Finance and Operations

3. Select Save As and save the file as Txt.

Exporting text format Positive Pay file

Exporting text format Positive Pay file in D365 for Finance and Operations

Special thanks to my teammate Karl Gunderson for lending his XSLT expertise to this project on how to export a text format positive pay file in Dynamics 365 for Finance and Operations.


Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.

Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!