function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lukáš ZářeckýLukáš Zářecký 

Hi, I need to help with formula for data restriction:


Limiting Samples – Customer cannot get more than 4 samples per month, nor can a Customer get more than 2 of any particular color in a month. o Accomplish this based on “no code” method, using default salesforce functionality o Accomplish this based on “only code”, so salesforce functionality

I created custom object "products" and can add from related list to customer for ex. 2 green boxes, 1 red, 1, blue..

there is whole taks:

I run an organization that sells blue, red, and green gift boxes. We are targeting stores in shopping malls to use our gift boxes for gift wrapping their merchandise. Our sales people call and go store to store at the malls talking to store owners about our boxes. I need to be able to track their efforts and determine which boxes are selling. To help the sales efforts, our sales people carry sample boxes that they distribute to store owners that show some interest. These samples are at a cost to my company so I need to track how many samples they are giving out. Ultimately, I need to know what my sales folks are doing, which sample boxes they are giving out, and how they are building our customer base. Can you help?

Couple of additional scenarios….

1. Limiting Samples – Customer cannot get more than 4 samples per month, nor can a Customer get more than 2 of any particular color in a month. o Accomplish this based on “no code” method, using default salesforce functionality o Accomplish this based on “only code”, so salesforce functionality

Create a “calculated” field on the Customer to keep a cumulative total of samples delivered to a customer.

Every time a sample is delivered to the customer, we need an email sent to the customer, email address would be stored in the Customer table .

• A few tips: 1) Use the documentation for Salesforce that you can find online 2) Use Accounts as your primary object, other than Accounts, Events, Reports try not to use standard Salesforce objects, like opportunities, products, leads etc.. Instead build your own solution using custom objects.
Purnima JothikrishnanPurnima Jothikrishnan
How are you linking the Product and the Customer objects ? is it through junction object ?
Lukáš ZářeckýLukáš Zářecký
Master-detail . I´m not sure if it is OK... So I have only two objects.. "Contacts" and custom object "product" .. I if you will have some solution? I will be very happy..
David ZhuDavid Zhu
Hi,
From my understanding, you can accomplish it by the followong.

set up master-detail relationship between customer and product objects. Customer - Master, Product - Detail.
Add a rollup summary field on Customer object.
Using the validation rule on the roll up summary to set the limit.

Hope this helps.

David
Lukáš ZářeckýLukáš Zářecký
Hi David,

many thanks for reply. Yes, you are right...I did it... BUT.. I don´t know how to write validation rule.. .this is my problem... Can oyu help with this example:
. Limiting Samples – Customer cannot get more than 4 samples per month, nor can a Customer get more than 2 of any particular color in a month. o Accomplish this based on “no code” method, using default salesforce functionality o Accomplish this based on “only code”, so salesforce functionality

If will be necessary I can share you my desk via teamviewer.. let me know