Home > Ax Technical > Creating Edit methods for DS that don’t allow editing in Dynamics ax – Followup

Creating Edit methods for DS that don’t allow editing in Dynamics ax – Followup

A while ago i made a post on allowing a edit method to work on a disabled datasource .. http://bit.ly/hZMBIW

I found a still better idea from one of the comments, this post is to highlight the comment.

I rather would loop trough all data source fields (FormDataObject) and set them allowEdit=false at initalization time of the form/ds. That’s more confortable for the user, because he sees, that he cannot modify other fields than the edit fields. – 

One suggestion that i would add along to this is creating a SysHelper class for this, in case you find this recurring. You can just pass the record or datasource and the method will disable all the fields.

public class SysDictTable extends DictTable implements SysDictXmlReflectionProvider, SysDictXmlDocumentationProvider
{
    public static void disableDSfields(FormDataSource _fds)
    {
        SysDictTable dictTable;
        int          i;
        ;

        dictTable = new SysDictTable(_fds.table());

        for (i = 1; i <= dictTable.fieldCntWithoutSys(); i++)
        {
            _fds.object(dictTable.fieldCnt2Id(i)).allowEdit(false);
        }
    }
}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: