Our users have an amount of swag products they can request a year, currently they are creating an opportunity and adding the swag products to the opportunity to generate the request. Is there any way that I can place a limit on the product per user of the quantity they can place in opportunities per year?
Thank you in advance for your help.
답변 3개
You can certainly do this, but it would require a combination of custom objects and/or apex.
You'd need a junction object between product and user - this would just store their max qualtity or $ value per user In addition to a running total of quantity/$ already used. Then, you need a trigger on Opportunity to updatethe running totals for each opportunity.
Finally, you need a validation within the trigger to count the current opp with the running total and compare with their limit.
You might also want a VisualForce page to manage quotas, as that could be pretty data-intensive, as the number of records in the junction is products * users. Or you could use data loader to manage it.