Add user range in DataSource in ax 2012

Description:-

If in your project multiple user working then you need to set user range on form, classes, tables etc.
Here I have given demo to set user range in form DataSource, so if multiple user open that form same time then data will be store in user wise in table like below.

First of all you have to changes in table property Set table Create By and CreatedDateTime to true.

Then in your form DataSource generate init and executeQuery method and declare QueryBuildRange in form declaration.

QueryBuildRange QBR;

In your DataSource init method add the range for Created By like below.

QBR = this.query().dataSourceNo(1).addRange(fieldNum(TableName,createdBy));

After in DataSource executeQuery apply the value like below.

QBR.value(curUserId());


Related Posts

Previous
Next Post »

Thanks for comments.....