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!
You're Genius!, Thanks it works!. The code is only needed at the end of created instead of in InitValue.
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.
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.
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.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156