In Sales order creation time, customer code lookup need filter for Blocked customer and first dimention, i tried the following method, but working only one filter. please check and give the solution.
queryBuildDataSource = query.addDataSource(tablenum(Custtable));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(Custtable,Blocked));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(Custtable,Dimension));
Your queryBuildRange variable can hold only a single object, therefore if you assign a new value, it doesn’t point to the previous one anymore. You could create a range, get its reference, set a value and then reuse the variable, but reusing variables is a bad practice, because it can easily lead to errors. Either use a separate variable for each range, or don’t use variables at all (e.g. qbds.addRange(…).value(…)).
Convert values for query ranges by queryValue() function, e.g. queryValue(NoYes::No).
Your code for accessing the dimension is wrong too. I suppose (based on the field name), that you’re using AX2009 or older. Dimension there are array fields and you have to access the individual dimension that you’re interested in.
First, get the index from the dimension code, e.g. int idx = Dimension::code2ArrayIdx(SysDimension::Department);
Then call fieldId2Ext() to access dimensions by index, e.g. addRange(fieldId2Ext(fieldNum(CustTable, Dimension), idx)).
Please always add a tag with your version of AX; the code regarding dimensions would be completely different in AX2012.
Its Working , i am using Ax-2009