You need to sign in to do that
Don't have an account?
My first trigger[please help!!!!]
trigger headqarterCreate on Organization__c (after insert) {
if (Trigger.isInsert) {List<Business_units> units = new Business_units__c[0];
for (Organization__c o : Trigger.new) {units.add(new Business_units__c
(name = o.Headquarter_company_name__c));}
insert units;
}
}
After insert Organization__c record
force say
Error: Invalid Data.
Review all error messages below to correct your data.
Apex
trigger CloudBudget.headqarterCreate caused an unexpected exception,
contact your administrator: CloudBudget.headqarterCreate: execution of
AfterInsert
caused by: System.DmlException: Insert failed. First exception on row
0; first error: REQUIRED_FIELD_MISSING, Required fields are missing:
[CloudBudget__Organization__c]: [CloudBudget__Organization__c]:
Trigger.CloudBudget.headqarterCreate: line 5, column 7
???
The error message is that you have required fields missing when attempting to insert. It appears that the system is expecting Organization__c to be defined.
What required fields have you configured for Business_Units__c?
All Answers
The error message is that you have required fields missing when attempting to insert. It appears that the system is expecting Organization__c to be defined.
What required fields have you configured for Business_Units__c?
Master-Detail field to Organization__c are required for Business_Units__c