Monday, February 28, 2011

Table methods using ValidateWrite() ValidateDelete() initValue() ModifiedField() - Microsoft Dynamics AX 2009

Table methods using ValidateWrite() ValidateDelete() initValue() ModifiedField()

initValue()This method file while creating new record to initialize a value, here I am assigning user id to the userID field.

public void initValue()
{
super();
this.UserId = curuserid();
}

ValidateDelete()While deleting a record if we want to put any validation we can use this method. Here once I delete a record populating a info that deleted record.

public boolean validateDelete()
{
boolean ret;
ret = super();
info(this.AccountNum);
return ret;
}

ValidateWrite()

This method will get to fire when we update a record. here I am using to check mandatory field for address AccountNum

public boolean validateWrite()
{
boolean ret;
;
if(this.Address != "")
ret = super();
else
warning(" Please fill the address value");
return ret;
}

ModifiedField()

This method will execute if modified a record value, this works based on the field value.
Here I am using to fill the name field value according to the AccountNum

public void modifiedField(fieldId _fieldId)
{
CustTable ct;
;
super(_fieldId);
switch(_fieldId)
{
case fieldNum(Cust_new,AccountNum) :
{
this.Name = CustTable::find(this.AccountNum).Name;
}
break;
}
}

4 comments:

  1. Nice Post...Good For New Generation of Ax

    ReplyDelete
    Replies
    1. Thank you very much. I'm glad it was helpful to you.

      Have a great day, and thanks for reading my blog.

      Delete
  2. This is axapta ERP blog for Technical and functional fields and includes Microsoft Dynamics Axapta tutorials and Dynamics Axapta Coverage. This blog also contains x++ code help for Ax developer and solution of technical and functional daily issues. This blog is specific for Microsoft dynamics programming. Enterprise portal, SharePoint services, business connectors and Enterprise Resource Planning applications and sql database.It will help to get Microsoft Business Solutions.


    axapta ERP blog

    ReplyDelete
    Replies
    1. Hey .. thanks for sharing your blog here.

      Delete

Thank you for your thoughts. Your comment will appear in my blog shortly after review.

Have a great day!