Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to change Sales Order form line detail line status in d365fo

(0) ShareShare
ReportReport
Posted on by 630

Hi Friends,

I added one customized button on sales order form action pane.

I want when i click on customized button then SALESLINE table SALESSTATUS should be change to Invoiced.

I am doing this by following code.

[ExtensionOf(FormDatasourceStr(SalesTable,SalesLine))]
final class SalesTabele_FormIBC_Extension
{

        public void displayOption(Common _record, FormRowDisplayOption _options)
    {
        SalesLine  salesline,saleslineloc;
        FormDataSource    fds = element.SalesLine_ds;
        salesline  = fds.cursor();
        SalesTable SalesTable;

        next displayOption(_record, _options);

          select SalesTable where SalesTable.SalesId == salesline.SalesId;

        if(salesline.RecId != 0)
        {
            ttsbegin;
            select forupdate saleslineloc where saleslineloc.SalesId == salesline.SalesId;
            saleslineloc.SalesStatus = SalesStatus::Invoiced;
            saleslineloc.initFromSalesTable(SalesTable);
            saleslineloc.doUpdate();
            ttscommit;
        }
    }

}

By using this i can see status is changing in table but in form line status is not changing.

Please tell me how i can change in form.

Thaks & Regards

Rahul

  • Suggested answer
    RE: How to change Sales Order form line detail line status in d365fo

    Hi,

    There is a new feature you could use out of box. It is called "Correct sales order lines manually". For ref: docs.microsoft.com/.../purchase-order-line-data-issues

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,671 Moderator on at
    RE: How to change Sales Order form line detail line status in d365fo

    I am not sure about your business requirements but what you are doing is wrong . You can not change status of sales order or lines to invoiced through button click which does direct update to the table without posting any transactions. You have to post invoice for those lines which will change the status to invoiced and post entries to subledger , ledger and reduced inventory.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How to change Sales Order form line detail line status in d365fo

    Hi Rahul, 

    You code doesn't make any sence.

    1.DisplayOption method is used for UI manipulations, but not for data update. 

    2. Sales order status depends on quantities and if you want to change status to invoiced you need to post invoice or reduce order open quantity through delivery reminder form. Changing status from code most likely will not work as status can be drop to correct one based on quantities later. 

    d365tour.com/.../

  • Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,421 on at
    RE: How to change Sales Order form line detail line status in d365fo

    Hi Rahul,

    Why are you writing this code to change SalesStatus? The status should change once you invoice the order and the lines.

    You shouldn't be doing it through a job.

    Please explain your business requirement.

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: How to change Sales Order form line detail line status in d365fo

    Hi Rahul,

    The Table has changed, but the form has not changed?

    Have you tried to refresh the form ? research(true).

    mohsinkhalid.com/.../

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans