function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
splitsplit 

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

 

 

 

???

Message Edited by split on 01-06-2010 06:20 AM
Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

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

bob_buzzardbob_buzzard

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?  

This was selected as the best answer
splitsplit

Master-Detail field to Organization__c are required for Business_Units__c

 

splitsplit
Great thanks! It worked! You really inspired me to go further with my app !