Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

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

Posted on by Microsoft Employee

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

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    you are already an active user of community, as you can post comments on this thread. you may create a new thread by clicking here.

    or use below URL directly.

    https://community.dynamics.com/ax/f/33/p/addpost?GroupToJoin=56

  • psined Profile Picture
    psined on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    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..

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    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
    psined on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    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
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    @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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Auto Email from AX to customers while click on post button of payment journal

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

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    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
    Community Member Microsoft Employee on at
    RE: Auto Email from AX to customers while click on post button of payment journal

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

  • Martin Dráb Profile Picture
    Martin Dráb 230,064 Most Valuable Professional on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    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
    Community Member Microsoft Employee on at
    RE: Auto Email from AX to customers while click on post button of payment journal

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans