web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Auto Email from AX to customers while click on post button of payment journal

(1) ShareShare
ReportReport
Posted on by

Dear Experts,

I  am new in X++, I wrote a clicked method on the post button of LedgerJournalTransCustPaym form, my method is sending email to top one customer in payment journal not all the customers who are exist in the same journal. I want to send emails to all the customers who's payment is received in the journal which we are going to post. help required, clicked method is giving below.

void clicked()

{


SysEmailId sysEmailId = 'PayEmail';
str recipientEmail = "erpadmin@test.com";
CustTable custTable;
Map mappings;
;
super();


custTable = LedgerJournalTrans.findCustTable();
recipientEmail = custTable.email();

mappings = new Map(Types::String, Types::String);
mappings.insert('CustomerName', custTable.name());
mappings.insert('InvoiceNo',LedgerJournalTrans.MarkedInvoice );
mappings.insert('EntryDate',LedgerJournalTrans.TransDate );
mappings.insert('Amount', LedgerJournalTrans.AmountCurCredit);

SysEmailTable::sendMail(
sysEmailId,
SysEmailTable::find(sysEmailId).DefaultLanguage,
recipientEmail,
mappings,
'',
'',
true,
curUserId(),
true);

}

Thanks in advance.

-Aamir Raza

*This post is locked for comments

  • Martin Dráb Profile Picture
    240,793 Most Valuable Professional on at

    What exactly do you need from us? You don't know how to find customers used in the journal, how to find e-mail address of a given customer, or what?

    By the way, please don't use filter Microsoft Dynamics AX (current version) for questions about AX 2012. (I've already fixed it for you.)

  • Community Member Profile Picture
    on at

    Hi Martin,

    I just wanted to know that how can i loop this method to send multiple emails to those customers whose payment details are posting in a single journal which we are going to post. It is just sending one email to the top one customer.

  • Martin Dráb Profile Picture
    240,793 Most Valuable Professional on at

    Well... does it mean that you don't know how to use X++ construct for loops, such as while select, or do you have any particular problem?

  • Community Member Profile Picture
    on at

    Exactly... i am not familiar with this language i just need syntax of loop in above method.

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Hi Syed,

    Here you go while select statement syntax https://msdn.microsoft.com/en-us/library/aa558063.aspx

     

    I think you are looking for something like 

     

    while select ledgerJournalTrans
    where ledgerJournalTrans.JournalNum == 'your journal number'
    {
    
    }



     

  • Community Member Profile Picture
    on at

    Thank you very much for your help ievgen Miroshnikov...

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    @syed,

    make sure your end-user is not posting one payment into multiple lines of journal

    or user is not settling multiple invoices with one line of payment.

    In those cases, it is long  story than only while select.

  • psined Profile Picture
    on at

    Hi all,

    Although this is an old thread, I wanted to revive it since I have pretty much the same issue and I have already tried the remedies suggested by all contributors.

    Every now and then when we attempt incremental CIL build we get hailed by similar errors from standard AX code:

    CIL generation: Error: .NET Cast Type Name not found. Type System.String found on the stack. This code in Class/Table: PCRuntimeConfigurator, Method: calculationSummaryEventHandler may not work in CIL run time. \Classes\PCRuntimeConfigurator\calculationSummaryEventHandler 1 calculationSummaryEventHandler Err:351 

    This continues to happen even after ensuring we compile using the client installed on the computer hosting the AOS and despite that the assembly Microsoft.Dynamics.AX.Xpp.Support.dll was copied from C:\Program Files\Microsoft Dynamics AX\60\Server\[AOS instance]\bin\ to C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\.

    Any ideas what else might be missing?

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Hi psined,

    unfortunately you are on a wrong place, in the sense that this thread does not reflects any relationship to your problem. we recommend you to create a new thread/question.

    In addition, when you will create thread, make sure to provide as much details as you can e.g. PCRuntimeConfigurator is not a standard AX class, so you have to explain what it is and how it looks. Kindly create a new thread.

  • psined Profile Picture
    on at

    Yes, I realized that only after the post was created - for some reason the forum application has associated my reply with completely wrong thread, not sure how it happened. Please pardon the confusion this all has created. I've attempted to retract the post, but all I got was "access denied" - something for admins to look into..

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans