Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Insert Sales Taker/ sales Responsible name to Customer Invoice Transaction

Posted on by Microsoft Employee

I want to Custom at Customer Invoice Transaction Report and Insert Sales Taker or Sales Responsible Name

i using this code

  recId = HcmWorker::find(SalesTable.WorkerSalesTaker).Person;
        select * from hcmWorker
        where hcmWorker.Person == wrIdRec;
        tmp.SalesResponsible = hcmWorker.name();

or

  recId = HcmWorker::find(custInvoiceJour.WorkerSalesTaker).Person;
        select * from hcmWorker
        where hcmWorker.Person == wrIdRec;
        tmp.SalesResponsible = hcmWorker.name();

but it doesn't work to display sales worker/sales responsible

i think because query dataSourceTable using custInvoiceJour Table not SalesTable/SalesLine

but at Customer Invoice Transaction Report must using custInvoiceJour, any body help me to insert sales taker in this report?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Insert Sales Taker/ sales Responsible name to Customer Invoice Transaction

    Thank You So Much!!!

    It Work For me

    :D

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Insert Sales Taker/ sales Responsible name to Customer Invoice Transaction

    Could you please tell us what you have done and what "does not work" ? We can't help you if we don't know what code do you have.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Insert Sales Taker/ sales Responsible name to Customer Invoice Transaction

    Hi ievgen Miroshnikov,

    still doesn't work :(

  • Verified answer
    Faqruddin Profile Picture
    Faqruddin 1,869 on at
    RE: Insert Sales Taker/ sales Responsible name to Customer Invoice Transaction

    Hello Rihanarika,

    //First create following static method on CustInvoiceJour Table;

    public static CustInvoiceJour findFromInvoiceId(InvoiceId _invoiceId)
    {
    CustInvoiceJour custInvoiceJour;

    if (_invoiceId)
    {
    select firstonly custInvoiceJour
    where custInvoiceJour.InvoiceId == _invoiceId;
    }

    return custInvoiceJour;
    }

    //Second create display method on CustInvoiceJour table and find the worker with each invoice id...

    public display Name workerSaleTaker()
    {

    return HcmWorker::find(CustInvoiceJour::findFromInvoiceId(this.InvoiceId).WorkerSalesTaker).name();
    }

    Now you can use above method form or report as per your requirement..

    Regards,

    Faqru 

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Insert Sales Taker/ sales Responsible name to Customer Invoice Transaction

    Hi rihanarika,

    Try this

    HcmWorker hcmWorker = HcmWorker::find(custInvoiceJour.WorkerSalesTaker);
    if (hcmWorker)
    {
        salesTakerName = hcmWorker.name();
    }
    

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans