You need to sign in to do that
Don't have an account?
dxb_Man
Need Your help in apex code /Triggers
I have two questions regarding the apex code and triggers,
First question,
What is the apex code or Triggers for preventing an account to have many opportunities? [one account should have one opportunity]
Second question
If I have a field called number of opportunities in XYZ object, so how I can prevent one Account not exceed the number of opportunities. So if the number 5, should one account only have 5 opportunities
THANKS
First question,
What is the apex code or Triggers for preventing an account to have many opportunities? [one account should have one opportunity]
Second question
If I have a field called number of opportunities in XYZ object, so how I can prevent one Account not exceed the number of opportunities. So if the number 5, should one account only have 5 opportunities
THANKS
well you would write the trigger at the opportunity end and count how many opportunities the account has then add an error message to the current opporunity, or overwrite the new button and use some javascript or visualforce page which checks how many opportunities there are before creating a new opportunity, if doesn't exceed then redirect them to the new opportunity page.
Have some static global variable for this exceed amount or calculate this value for individual accounts.
can you send me sample of Trigger code ??
if you don't mind