Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Microsoft Dynamics AX 2009 : Changing automatic transaction text

12/23/2011 6:35:58 PM
Every financial transaction in Dynamics AX can (and normally should) have a descriptive transaction text. Some texts are entered by user, some are generated by the system. The latter option happens for automatically generated transactions where the user cannot interact with the process.

Dynamics AX provides a way to define texts for automatically generated transactions. The setup can be found in Basic | Setup | Transaction text. Here the user can create custom transaction texts for various automatic transaction types and languages. The text itself can have a number of placeholders digits with percent sign in front of them, which are replaced with actual values during the process. Placeholders can be from %1 to %6 and they are replaced with the following values:

  • %1: the transaction date

  • %2: a relevant number like invoice, delivery note, etc.

  • %3: the voucher number

  • %4-%6: custom; depends on the module

Although most of the time the existing values are enough, I was still requested a number of times to add additional ones. One of the latest requests was to include the vendor name into vendor payment journal lines automatically generated by payment proposals. We will use this case as an example in this recipe.

Getting ready

First we need to make sure the vendor payment transaction text is set up properly. Open Basic | Setup | Transaction text, find a line with Vendor - Payment, Vendor and change the text to Payment to %5 like the following:

How to do it...

  1. 1. Open AOT, find the CustVendPaymProposalTransferToJournal class and add the following code to its getTransactionText():

    transactionTxt.setKey2(
    _custVendPaymProposalLine.custVendTable().Name);
  2. right after:

    transactionTxt = new TransactionTxt(
    LedgerTransTxt::VendPaymentVend);
  3. 2. Open Accounts payable | Journals | Payments | Payment journal and create a new journal. Then create payment lines using the Create payment proposal function. Notice that now the transaction texts include vendor name:

How it works...

The lines generated by vendor payment proposals are transferred into the journal by using the CustVendPaymProposalTransferToJournal class. Its getTransactionText() method is responsible for formatting transaction texts. If we look inside it we can see that the TransactionTxt class is used for this purpose. The following methods are used for each placeholder:

  • %1: setDate()

  • %2: setFormLetter()

  • %3: setVoucher()

  • %4: setKey1()

  • %5: setKey2()

  • %6: setKey3()

By looking at the code we can see that only %4 (setKey1()) is used, so we can occupy %5 and fill it with the vendor name. To achieve that, we have to call setKey2() with the vendor name as an argument. We place the code in the ModuleCustVend::Vend section of the switch statement to make sure it is executed only when generating vendor payments.

There's more...

If more than 3 custom placeholders are required it is always possible to add an additional one by creating a new setKey() method in the TransactionTxt class. For example, if we want to add placeholder %7 we have to do the following:

Add the following code to the class declaration:

str 20 key4;

Create a new method:

void setKey4(str 20 _key4)

{;
key4 = _key4;
}

Change the last line of the txt() method to:

return strfmt(
txt,
transDate,
formLetterNum,
voucherNum,
key1,
key2,
key3,
key4);

After those modifications we can use setKey4() when generating transactions.

Although even more placeholders could be added, it should be considered that the transaction text field has a finite number of characters and excessive text will be simply truncated.

Other -----------------
- Microsoft Dynamics AX 2009 : Creating and posting ledger vouchers
- Planning the Installation : Installation Scenarios for IIS 7.0 (part 3) - Server Core Web Edition Server Workload
- Planning the Installation : Installation Scenarios for IIS 7.0 (part 2) - IIS Managed Modules and .NET Extensibility Server Workload & IIS Full Install
- Planning the Installation : Installation Scenarios for IIS 7.0 (part 1)
- Sharepoint 2010 : Configuring Crawls (part 3) - Using Server Name Mappings & Controlling Host Distribution
- Sharepoint 2010 : Configuring Crawls (part 2) - Creating and Managing Crawl Rules
- Sharepoint 2010 : Configuring Crawls (part 1) - Creating and Managing Content Sources
- Windows Server 2003 : Creating and Enforcing Security Policies (part 3) - Microsoft Baseline Security Analyzer
- Windows Server 2003 : Creating and Enforcing Security Policies (part 2) - Security Configuration and Analysis
- Windows Server 2003 : Creating and Enforcing Security Policies (part 1) - Using Security Policy Templates
 
 
Top 10 video Game
-   Unravel | Live Gameplay from E3 2015
-   Destiny: Xur, Agent of the Nine, Reef location and exotic items
-   Metal Gear Solid 5: The Phantom Pain | E3 2015 Stage Demo
-   OVERKILL's The Walking Dead | The VR Experience Trailer
-   Batman: Arkham Knight | NVIDIA GameWorks Gameplay Video
-   World of Warcraft: Warlords of Draenor | Patch 6.2 – Fury of Hellfire
-   Call of Duty: Black Ops III | Cyber Core Tutorial and Co-Op Playthrough
-   Back to Bed - E3 2015 Trailer
-   Whispering Willows - E3 2015 Trailer
-   Velocibox - E3 2015 Trailer
-   Anno 2025 - E3 2015 Gameplay Trailer
-   Anno 2025 - E3 2015 Intro Trailer
-   Awesome GTA V Sniper Chopper Kill
-   Awesome GTA V Parachute Video
-   GTA V Explosive Ammo Rounds with Bikini
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
programming4us programming4us
PS4 game trailer XBox One game trailer
WiiU game trailer 3ds game trailer
Trailer game
 
programming4us
MineCraft
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer