web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

create salesline through x++

(0) ShareShare
ReportReport
Posted on by 56

Hi Team,

I have a sales order in invoiced status. It is having already 4 lines.

*** Customer asked me to insert more 3 lines. I wrote below code

static void Job18(Args _args)
{
    SalesLine salesLine;
    ;
    salesLine.clear();
    salesLine.SalesId = "SO-00033417";
    salesLine.ItemId = "72202616";
    salesLine.createLine(NoYes::Yes, // Validate
    NoYes::Yes,       // initFromSalesTable
    NoYes::Yes,       // initFromInventTable
    NoYes::Yes,       // calcInventQty
    NoYes::Yes,       // searchMarkup
    NoYes::Yes);      // searchPrice
}

I saw, the existing item has LOT ID. Can you please let me know how i will insert lot ids for new 3 lines ?

is above code is ok? If I missed anything please let me know.

I have the same question (0)
  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    You need to fill InvenDim with correct values and set in salesLine.

    There are many examples of this on the Internet. I have shared the two below, but the important thing for you is to set the correct values and get the correct InventDimId with InventDim::findOrCreate().

    community.dynamics.com/.../proper-way-of-adding-salesline-using-x

    community.dynamics.com/.../create-sales-order-using-x

  • @rp@n Profile Picture
    56 on at

    Thanks Ergun,

    What about the Lot I'd?

    I need this because I need to update SALESID and LotId in some other form for reference after successfully done sakeline

  • ergun sahin Profile Picture
    8,826 Moderator on at

    Set qty/amount values

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans