Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

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?

  • 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,867 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,537 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,520 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans