You need to sign in to do that
Don't have an account?

Pass Date from Custom Object to Standard Object
I've tried a few variations and can't seem to get it right.
I need to pass a date from a custom object (Appliance__c) to a standard object (Entitlement). There is a lookup field to the custom object from the entitlement object.
Date on the appliance is called "Latest_Check_In_Date__c" and the date on the Entitlement is called "first_check_in_date__c"
Any help would be greatly appreciated.
Here is the code I have so far which results in an error: Error:Apex trigger EvalFirstCheckIn caused an unexpected exception, contact your administrator: EvalFirstCheckIn: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []: Trigger.EvalFirstCheckIn: line 16, column 1
trigger EvalFirstCheckIn on Appliance__c (before update, after insert) { List<Id> Ids = new List<Id>(); for(Appliance__c App : Trigger.new) { Ids.add(app.id); } List<Appliance__c> applist = new List<Appliance__c>([Select Id, latest_check_in_date__c FROM Appliance__c WHERE Id in :Ids]); for(Appliance__c temp : applist ) { Entitlement ent = new Entitlement(); ent.first_check_in_Date__c = temp.Latest_Check_In_Date__c; update ent; } }
You need to get the Entitlement object associated with taht appliance before you can update it, and you do that through the relationship field you set up (the lookup field from Entitlement to Appliance__c). Try this code, but replace Relationship_Field__c with the name of the lookup between your objects.
All Answers
You need to get the Entitlement object associated with taht appliance before you can update it, and you do that through the relationship field you set up (the lookup field from Entitlement to Appliance__c). Try this code, but replace Relationship_Field__c with the name of the lookup between your objects.
Thanks a bunch! That worked great. I added an if statement so now the date only passes when certain criteria are met.
Here's the final code: