• Sudipto Ghosh 12
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
I have 2 Custom Objects 'Job_Posting__c' and 'Employment_Website__c'.
'Employment_Website__c' is the master object and 'Job_Posting__c' is the child object of the Master Detail Relationship.
 
I want to write a Trigger so that whenever there is a change in a Field 'Price_Per_Post__c' of the 'Employment_Website__c' Object, the 'City__c' Field of all the related (Child) records gets changed to 'Atlanta'.
 
This is the code I wrote:
 
trigger ChangingChildValue on Employment_Website__c (after insert, after update) {
    Job_Posting__c JP = new Job_Posting__c();
    for (Employment_Website__c EMP : Trigger.old)
    {
        System.debug('Price Per Post' + EMP.Price_Per_Post__c);
        if(EMP.Price_Per_Post__c > 50){         
            JP.City__c = 'Pune';
        }
       
    }
    update JP;
}
 
I am getting the below error when I change the Price Value and Save the parent record:
 
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger ChangingChildValue caused an unexpected exception, contact your administrator: ChangingChildValue: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []: Trigger.ChangingChildValue: line 11, column 1

 
I am new Development, any help would be really great. Thanks.
 
I have 2 Custom Objects 'Job_Posting__c' and 'Employment_Website__c'.
'Employment_Website__c' is the master object and 'Job_Posting__c' is the child object of the Master Detail Relationship.
 
I want to write a Trigger so that whenever there is a change in a Field 'Price_Per_Post__c' of the 'Employment_Website__c' Object, the 'City__c' Field of all the related (Child) records gets changed to 'Atlanta'.
 
This is the code I wrote:
 
trigger ChangingChildValue on Employment_Website__c (after insert, after update) {
    Job_Posting__c JP = new Job_Posting__c();
    for (Employment_Website__c EMP : Trigger.old)
    {
        System.debug('Price Per Post' + EMP.Price_Per_Post__c);
        if(EMP.Price_Per_Post__c > 50){         
            JP.City__c = 'Pune';
        }
       
    }
    update JP;
}
 
I am getting the below error when I change the Price Value and Save the parent record:
 
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger ChangingChildValue caused an unexpected exception, contact your administrator: ChangingChildValue: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []: Trigger.ChangingChildValue: line 11, column 1

 
I am new Development, any help would be really great. Thanks.
 
how to use harddelete in datalodaer.plz tel steps