Wednesday, July 17, 2019

D365: Converting Unit from any to PL


Converting Unit from any to PL

Real PL: UnitOfMeasureConverter::convert(Item Unit Qty,
                    UnitOfMeasure::unitOfMeasureIdBySymbol(Item UnitId),
                    UnitOfMeasure::unitOfMeasureIdBySymbol('PL'),
                    NoYes::No,
                    InventTable::itemProduct(ItemId),
                    NoYes::No);


PL to CS Example

Real CS= UnitOfMeasureConverter::convert(PL Value,
                    UnitOfMeasure::unitOfMeasureIdBySymbol('PL'),
                    UnitOfMeasure::unitOfMeasureIdBySymbol('CS'),
                    NoYes::No,
                    InventTable::itemProduct(ItemId),
                    NoYes::No);

Exporting Text or CSV Format Positive Pay File in Dynamics 365 Finance and Operation





Set up xslt:

Goto Cash and Bank Management >Set up>Positive Pay formats
Create New Format
Transformation input format must be xml-element

Click 'Upload file use for transformation' to load the xslt file

xslt file Template format. Copy and paste the following in notepad and save as Sample.xslt file

<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" version="1.0" encoding="utf-8"/>
  <xsl:template match="/">
    <xsl:value-of select="''" />
    <Document>
      <xsl:value-of select="''" />
      <!--Header Begin-->
      <xsl:value-of select='string("Account No,BankId,Check No,Amount,Issue Date, Add Cancel Indicator,Payee")'/>
      <xsl:value-of select="''" />
<xsl:text>&#xd;</xsl:text>
      <!--Header End-->
      <xsl:for-each select="Document/BANKPOSITIVEPAYEXPORTENTITY">
        <!--Cheque Detail begin-->
        <xsl:value-of select='ACCOUNTNUM/text()'/>
        <xsl:value-of select="','" />
<xsl:value-of select='string("Test")'/>
        <xsl:value-of select="','" />
  <xsl:value-of select='CHEQUENUM/text()'/>
        <xsl:value-of select="','" />
<xsl:value-of select='AMOUNTCUR/text()'/>
        <xsl:value-of select="','" />
  <xsl:value-of select='TRANSDATE/text()'/>
        <xsl:value-of select="','" />
<xsl:choose>
          <xsl:when test='CHEQUESTATUS/text()=normalize-space("Payment")'>
            <xsl:value-of select='string("I")'/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select='string("C")'/>
          </xsl:otherwise>
        </xsl:choose>
<xsl:value-of select="','" />
        <xsl:value-of select='BANKNEGINSTRECIPIENTNAME/text()'/>
<xsl:text>&#xd;</xsl:text>
       </xsl:for-each>
    </Document>
  </xsl:template>
</xsl:stylesheet>

Set up format on Bank Account : 


Goto Cash and Bank Management >Bank Accounts

Click the Bank account which you want to set up the Positive Pay Format
Select the Positive Pay Format ( xslt which you created)



Wednesday, November 16, 2011

Changing Form Color based on company

You have to override SysSetupFormRun.run() method




public void run()

{

;
super();

// Set the color scheme of this instance of SysFormRUn to RGB
this.design().colorScheme(FormColorScheme::RGB);

// Switch and based on the current company change colors, or not for default

switch (curext())
{
case 'dat':
this.design().backgroundColor(WinAPI::navisionColorRed());
break;

case '001':
this.design().backgroundColor(WinAPI::navisionColorBlue());
break;

default:
break;
}
}