I have a question as a matter of interest only.
I was completely perplexed why a simple SETFILTER, FIND('-') routine was giving me a Read Error.
I had set a Security Filter on the a field in the Sales Header.
Although the user could access all the documents that would have been returned by the filter directly (via the Sales Quote Form, Sales Order Form, etc.), the user would receive a Read Error when performing a lookup.
I came across SETPERMISSIONFILTER and it solved my problem.
SalesHeader.SETPERMISSIONFILTER;
IF SalesHeader.FIND('-) THEN ........
Can someone tell me why Navision wouldn't do this by default?
The whole reason for entering a Security Filter is to filter records.
What could be gained by not including SETPERMISSIONFILTER?
All I received was an Error Message (and a headache ](*,) ).
Thank you very much in advance.
Answers
In the UI there is no harm in automatically stripping out the records that the user may not see, and this is desired - but in running code it is left up to the developer to determine if applying the security filter is safe, by explicitly using SETPERMISSIONFILTER, since it very much depends on the security filter you're using.
This posting is provided "AS IS" with no warranties, and confers no rights.
Thank you very much.