Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
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
    Menekse Saygili Profile Picture
    on at
    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
    71,682 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
    23,091 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
    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
    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,886 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,768 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans