View's criteria based on list returned by a user function?

View's criteria based on list returned by a user function?

Hi,

I am trying to create a sort of e-commerce application where dealers can purchase items from a manufacturer directly, or distributors can purchase the items on behalf of them.

I am currently building out the functionality of a sort of "shopping cart", which is stored server-side. My goal is to create a view where dealers can view all of their orders, whereas distributors can view the orders that are made by dealers that they are associated with.

I have a user function ViewableDealers(email_address) that will take a parameter of a user's (dealer or distributor) e-mail and return a list of the names of Dealers that the user is associated with. I have used this function to build working forms for other parts of the application, and have tested it thoroughly, so I know it works properly.

I have been trying to create a view for the shopping cart that displays records where the dealer assocaited with the record is in the list of dealer names returned by ViewableDealers(zoho.loginuserid). This is the snippet of code that I'm trying to use to implement this:


show  all  rows  from  Order_Form [erp_system.ViewableDealers(zoho.loginuserid).contains(Dealer)]
    (
        Dealer
        Product
        Unit_Size as "Unit Size"
        Color
        Quantity
        Price
        Cost, display total
    )












When I try to save this script, I get an error message reading "Error modifying the page" followed by "null".

Any ideas why my code isn't working, or for an alternative means of reaching the same result? (I suppose I could always create a custom HTML view that displayed records in a table based on this criteria, but I'd rather use the default list-style view than write out all of my own code.)