Hi ,
I have to disable the unit price field from editing , untill Each line items gets saved in the table level .
Since InventTransId for each line will be generated only when the line item is saved . (If there is any error system wont generate InventTransId ). As I am inserting some data into the custom table whenever the unitprice is modified .
So I need to disable the UnitPrice field of the particular line untill the system generates the InventTransId .Is it possible to do that . If so can someone tell me how to achieve that using chain of command ?
What additional code you want to write?
If it works on the active method - You can write the logic on the active method itself.
No need to call the write method - It will be called automatically when you click the save button.
Thanks,
Girish S.
Because I need the return value of write method inside the active method
Hi Girish ,
[ExtensionOf(formDataSourceStr(SalesTable, SalesLine))] final class SalesLine_DS_Extension { public int active() { int ret = next active(); SalesLine salesLineLocal = this.cursor(); if(salesLineLocal.RecId == 0 ) { this.object(fieldNum(SalesLine, SalesPrice)).allowEdit(false); } else { this.object(fieldNum(SalesLine, SalesPrice)).allowEdit(true); } return ret; } }
This code works but I need to write some additional conditions ,whether can I call the formdatasource write method inside the formdatasource active(COC) method
Hi NoobGamer,
As you said already InventTransId field will be generated only after the particular line item is saved.
In that scenario you can add the code in the write method of form datasource level.
Add COC for write method - Get the current cursor - Based on the cursor check whether the InventTrans Id field is not empty - enable the field - If its a empty you can disable the Unit price field.
Also disabling the particular field will disable that control for all the lines. So you need to add the same code in "SelectionChanged" method of form datasource also.
Thanks,
Girish S.
André Arnaud de Cal...
292,111
Super User 2025 Season 1
Martin Dráb
230,934
Most Valuable Professional
nmaenpaa
101,156