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?
Making a custom catalog
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
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
-
- Posts: 595
- Joined: Sun Apr 24, 2005 2:22 am
- Contact:
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.
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
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
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
I tried this approach, and it didn't work under testing mode for some reason. In fact, here is the code I used: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.
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?
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.
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.
-
- Posts: 595
- Joined: Sun Apr 24, 2005 2:22 am
- Contact: