Announcements
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!
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.
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.
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.
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.
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 463 Super User 2026 Season 1
Subra 409
Martin Dráb 280 Most Valuable Professional