Announcements
Hi Guys,
I have a requirement when i create a new purchase order and clicking ok button the delivery date will be getting populated automatically in purchase order header similarly confirmed delivery date also needs to populate
I am using the below code but when i debug and see i am not getting the buffer for purchtable . Please guide me on this
[FormControlEventHandler(formControlStr(PurchCreateOrder, OK), FormControlEventType::Clicked)]
public static void OK_OnClicked(FormControl sender, FormControlEventArgs e)
{
PurchTable callerRec = sender.formRun().dataSource(1).cursor();
if(callerRec.RecId)
{
callerRec.ConfirmedDlv =callerRec.DeliveryDate;
}
}
Thanks Martin for the help . This is the final code which got me the results.
[ExtensionOf(formdatasourcestr(PurchCreateOrder ,PurchTable))]
final class RNT_PurchaseTable_Extension
{
public void initValue()
{
FormDataSource fds= this;
PurchTable purchTable =fds.cursor();
next initValue();
purchTable.ConfirmedDlv = purchTable.DeliveryDate;
}
In my opinion, such logic doesn't belong to the Click button at all.
OnInitValue event of the form datasource would be a much more appropriate place.
André Arnaud de Cal...
294,120
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator