Making a custom catalog

Contains tips for configurators working with Aware IM
Post Reply
woof65
Posts: 16
Joined: Sun Aug 05, 2007 4:10 pm
Location: Louisville, KY
Contact:

Making a custom catalog

Post by woof65 »

I'm using the Ordering database as a template for my test project. So far so good, but I have ran into something I haven't figured out how to do.

I want to have the customers see only the products they are allowed to purchase. For this, I have set up an attribute in both the Customer and Product business objects for handling a Customer's Franchise Number. When we enter a new customer, this Franchise Number (which the customer already has prior to entry into the system) is entered in with the rest of their data. I want to use this number as a filter to show only products relating specifically to that Franchise Number or that can be seen by all.

What do I have to do to get this to happen? Would I put a Rule into the Product or LineItem object? What would the Rule look like?
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

woof65,

Assumptions:
1- You have made your Customer BO part of the SystemUser BO Group
2- Customer BO has an attribuute Customer.FranchiseNumber
3- Product BO has an attribuute Product.FranchiseNumber


You can construct a query of the Product BO that "filters" for Product.FranchiseNumber=LoggedInSystemUser.FranchiseNumber

You can also use similar syntax in a FIND ..... WHERE action which would be part of a process.

Since there is only 1 instance of the LoggedInSystemUser, it's attributes can be used in any query.

You can find examples of LoggedInSystemUser in these CRM sample database queries:
1- Communication with customer using single parameter
2-Logged in staff calendar
3- Communication with customer

Is this what you were looking for?

Tom
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

An alternative approach is to use a protection rule on object Product like this:

If Product.FranchiseNumber <> LoggedInCustomer.FranchiseNumber Then READ PROTECT Product FROM Customer

This way the customer will not see the non-matching products anywhere. The system will automatically filter out such products from any query results, object forms, etc.
Aware IM Support Team
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Support,

Thanks for the tip! That's more than an alternative, it's obviously the best approach.

What an amazing product & I feel like I'm just scratching the surface in understanding it's power. My old programming experience still has me often trying to do things the 'hard way' -- with more steps than needed by AwareIM.

Tom
woof65
Posts: 16
Joined: Sun Aug 05, 2007 4:10 pm
Location: Louisville, KY
Contact:

Post by woof65 »

I agree with Tom's sentiment. The more I work with this program the more amazed I'm with it. My main problem is tossing out a lot of old baggage and thinking of things in a new way.
woof65
Posts: 16
Joined: Sun Aug 05, 2007 4:10 pm
Location: Louisville, KY
Contact:

Post by woof65 »

aware_support2 wrote:An alternative approach is to use a protection rule on object Product like this:

If Product.FranchiseNumber <> LoggedInCustomer.FranchiseNumber Then READ PROTECT Product FROM Customer

This way the customer will not see the non-matching products anywhere. The system will automatically filter out such products from any query results, object forms, etc.
I tried this approach, and it didn't work under testing mode for some reason. In fact, here is the code I used:

IF Product.AtriaCommNumber<>LoggedInCustomer.AtriaCommNumber
OR
Product.AtriaCommNumber<>'9999'
THEN
READ PROTECT Product FROM Customer

The second and third lines allow some products to be available to all clients, or it is supposed to. This rule is on the Product business object. Can anyone see what I am doing wrong?
woof65
Posts: 16
Joined: Sun Aug 05, 2007 4:10 pm
Location: Louisville, KY
Contact:

Post by woof65 »

To clarify, here is what I got in testing.

I set up three customers with individual AtriaCommNumber's. I set up 4 products, one for each customer to see on their own and another using the generic '9999' number. What should happen is that each customer should see two products in their list. When I log in to a particular customer, and ask the database to show all products, it generates a form that has the text 'Results for Product - presentation - 2 items', and nothing but a green box underneath it.

If I go back and delete the rule out of the Product BO, the search for all products returns all 4 products, no matter which customer I am logged into.
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Try using AND instead of OR in your rule.
Aware IM Support Team
Post Reply