I want to keep a cap of 200 companies in salesforce as we have multiple users and we dont want to add anymore companies above 200. How can i do that. Please suggest...
I want to keep a cap of 200 companies in salesforce as we have multiple users and we dont want them to add anymore companies above 200. How can i do that. Please suggest...
This can be done by using trigger on before insert event of companies. On before insert you can count no. of records in the object and if they are less than 200 then insert otherwise not.
trigger <TRIGGER_NAME> on <OBJECT_NAME>(before insert){
Integer i = select count() from OBJECT_NAME;
if(i<200){
THEN WRITE YOUR INSERT CODE HERE
}else{
YOUR ERROR MESSAGE
}
}
let us know if you have any question . please don't Forget to Mark this as your best answer if it works fine for you
This can be done by using trigger on before insert event of companies. On before insert you can count no. of records in the object and if they are less than 200 then insert otherwise not.
let us know if you have any question .
please don't Forget to Mark this as your best answer if it works fine for you
Regards,
Grazitti Team
Web: www.grazitti.com.
Hope you got the qustion correctly as we dont want other users to add more than 200 companies.
You can find the same here https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_HelloWorld.htm