问题
I want to disable input into fields of a table, if another field contains data in MS Dynamics AX 2012.
UPDATE 1:
If Field1 has input, Field2 and Field3 MUST be EMPTY
|Field1|Field2|Field3| Customer nr | Id|
|---1---|--------|--------| 0000000001| 01
UPDATE 2:
Can the system fire an error/warning message, like it does when entering a duplicate value in an ID --> AllowDuplicates: No
-
Cannot create a record in Table (Table). Table Id: 01. The record already exists.
回答1:
Yes, make a method on the table.
In this case (on ProjTable
) the editing of the name on sub projects is prohibited:
void setFieldProperty()
{
FormObjectSet fds = this.dataSource();
if (fds)
{
fds.object(fieldNum(ProjTable,Name)).allowEdit(!this.ParentId);
}
}
Then call the method from the form datasource active
method and from datasource fields modified
methods on which the critieria depends (in this case ParentId
).
Response to UPDATE 2:
Take a look on aosValidateInsert and aosValidateUpdate
来源:https://stackoverflow.com/questions/10976083/is-it-possible-to-disable-input-in-one-field-if-another-is-filled