Tassisto
Tassisto

Reputation: 10345

Is it possible to disable input in one field if another is filled?

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.

Upvotes: 1

Views: 4736

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

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

Upvotes: 4

Related Questions