How to update query in list page per user in ax 2012

Description:-

In this article we will see about how to changes to update query range in listpage in Ax 2012.
Here I have given simple demonstration to update or modify query in list page per user in Ax 2012.
For Example: here I have took purchase listpage and in that listpage I have to update datquery for particular user so he/she can see only that data. For that I have changed in PurchTableListPageInteraction Class initializeQuery Method add user range for particular user, so that user can see that data what I have passed in range.

In Purchtable I have set on that user can see Confirmed and Approved which DocumentState have.
And which PurchStatus have OpenOrder and Received.
Or else you can see here how to pass multiple Enum range in query.
Like below.

if(curUserId() == "Username")
{
    qbds = _query.dataSourceTable(tableNum(PurchTable));
    qbds.addRange(fieldNum(PurchTable,DocumentState)).value(strfmt("%1,%2",enum2str(VersioningDocumentState::Approved),enum2str(VersioningDocumentState::Confirmed)));

    qbds.addRange(fieldNum(PurchTable,PurchStatus)).value(strfmt("%1,%2",enum2str(PurchStatus::Backorder),enum2str(PurchStatus::Received)));
} 

Related Posts

Previous
Next Post »

Thanks for comments.....