-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathD365fo_AllowEditFieldAndDataSource
48 lines (45 loc) · 2.23 KB
/
D365fo_AllowEditFieldAndDataSource
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//allow edit for brand name
public static class AREcoResProductDetailsExtended_Extension
{
[PostHandlerFor(formStr(EcoResProductDetailsExtended), formMethodStr(EcoResProductDetailsExtended, setItemStockedDependentObjects))]
public static void EcoResProductDetailsExtended_Post_setItemStockedDependentObjects(XppPrePostArgs args)
{
FormRun form = args.getThis();
FormDesign design = form.design();
FormDataSource fds = form.dataSource(formDataSourceStr(EcoResProductDetailsExtended,EcoResProduct));
fds.allowEdit(true);
FormControl brandName = design.controlName(formControlStr(EcoResProductDetailsExtended, ARBrandName));
brandName.allowEdit(true);
}
////////////////////////////////////////
[FormDataSourceEventHandler(formDataSourceStr(EcoResProductDetailsExtended, EcoResProduct), FormDataSourceEventType::Activated)]
public static void EcoResProduct_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
EcoResProduct ecoResproduct_update;
EcoResProduct ecoResproduct = sender.cursor() as EcoResProduct;
;
ecoResproduct_update.clear();
select forupdate firstonly1 ecoResproduct_update
where ecoResproduct_update.RecId == ecoResproduct.RecId;
if(ecoResproduct_update.RecId)
{
ttsbegin;
ecoResproduct_update.selectForUpdate(true);
ecoResproduct_update.ARBrandName = ecoResproduct.ARBrandName;
ecoResproduct_update.update();
ttscommit;
}
}
///////////////////////////////////////////
[FormEventHandler(formStr(RetailGiftCardTable), FormEventType::Initialized)]
public static void RetailGiftCardTable_OnInitializing(xFormRun sender, FormEventArgs e)
{ //sometimes we need to edit the form view
sender.design().viewEditMode(ViewEditMode::Edit);
FormDataSource fds = sender.dataSource(formDataSourceStr(RetailGiftCardTable,RetailGiftCardTable));
fds.allowEdit(true);
// set all datasource fields to non editable
allowEditFieldsOnFormDS_W(fds, false);
fds.object(fieldNum(RetailGiftCardTable, Category)).allowEdit(true);
fds.object(fieldNum(RetailGiftCardTable, PersID)).allowEdit(true);
}
}