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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Custom CreateProductionOrder Form to copy the sales order Id

(0) ShareShare
ReportReport
Posted on by 46

Hello guys,

I want to dinamically add the sales order number SalesId as the same Production number Id ProdId when creating a new production from a salesline.

I have already  check the clicked method: "salesLine.type().formProduction(element);" does not telling me too much. that goes to a framework were I dont know excacly where to look on where is writting exclacly the data from the sales into the form.

thanks a lot for your time!

pastedimage1596699334173v1.pngpastedimage1596700319342v2.png

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    The form name is ProdTableCreate.

    You could try to add following code in the initValue method of ProdTable data source on that form:

    SalesLine salesLineLocal; // Put this in the beginning of the metod
    
    // (...)
    
    // Put this after the super() call:
    if (callerBuffer.TableId == tableNum(SalesLine))
    {
        salesLineLocal = calleBuffer;
        prodTable.ProdId = salesLineLocal.SalesId;
    }

    Not that this will not work if you ever create two production orders from the same sales order (for example from different lines), since every ProdId must be unique.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,097 on at

    Hi CBNestor,

    The code in yellow opens a new form ProdTableCreate and waits until OK or Cancell button will be pressed. The Logic you want to apply should be added to that form as initalization for production order from source.

    If you open the form method ProdTableCreate\Data Source\ProdTable\initValue, you will find the place where initialization of ProdTable record can be applied from sales line.

  • CBNestor Profile Picture
    46 on at

    Hi Nikolaos, thanks for replaying. I have written your code as suggested. When I make debug the ProdTable.ProdId is getting the Id properly. but is not writting it into to the form. is still empty.

  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    By debugging you can find out that initValue() is called from super() call in create method of the data source.

    After the super() call there's logic to fetch prodId from number sequence. I guess it replaces your value with (empty) value from (manual) number sequence.

    So you have to move your code to the end of create method.

  • CBNestor Profile Picture
    46 on at

    You're Genius!, Thanks it works!. The code is only needed at the end of created instead of in InitValue.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Subra Profile Picture

Subra 409

#3
Martin Dráb Profile Picture

Martin Dráb 280 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans