Search This Blog

Wednesday, December 21, 2011

Validate Table Fields using X++



The following job is used to validate the fields same as like validatefield method in the form for the table.

You can create this method as the static method in any of your class and call that method and it will returns the table got valid data or not.

static server Boolean krishh_validateTable(common _common)
{
   boolean ret = true;
   SysDictTable    dictTable;
   int fieldCnt, i;
   fieldId fieldid;
   ;

    dictTable = new SysDictTable(_common.TableId);
    fieldCnt= dictTable.fieldCnt();
    for(i = 1; i <= fieldCnt; i++)
    {
       fieldid= dictTable.fieldCnt2Id(i);
       ret = ret &&;
       _common.validateField(fieldid);
    }
    return ret;
}

1 comment:

  1. Hi ,

    This is mani .As am new to AX I have an issue on sales order i needs to update the unitprice in sales order line after entered the batch number. i have a logic to pick the price but i don't know where i needs to write a code.. to update the price field after validate the batch number.. Pls help on this.

    Thanks in advance..
    Mani

    ReplyDelete

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.