You need to sign in to do that
Don't have an account?
sfdcianp
limiting the promotions to three
i have promotion object as an related list in the campaign object.
i need to enter only 3 promotions for that campaign , if at all i am entering another promotion it chould throw an error
please suggest the way to do this...
thanks in advance
sfdcinap
Hello,
you should implement the apex trigger on promotion object where you would check the number of promotions and throw an error.
Alternatively you can do also the following - only possible if you have master-detail relation between campaign and promotion:
- create a rollup summary "number of promotions" field on campaign
- use that field in validation rule of promotion object.
All Answers
Hello,
you should implement the apex trigger on promotion object where you would check the number of promotions and throw an error.
Alternatively you can do also the following - only possible if you have master-detail relation between campaign and promotion:
- create a rollup summary "number of promotions" field on campaign
- use that field in validation rule of promotion object.
See if your Promotion is having master detail relation ship with campaign then you can write rollup summry field which will count number of child records ( promotion records ) unser Campaign and then write a validation that if parent record's rollup feld value is more then 3 then child record will not be saved.
Second way is trigger on before inserting o count existing child records and if it is more then 3 then will not allow user to insert a new child record on campaing.