I have 2 objects, "Ticket" and "Ticket Item". They have a master-detail relationship with Ticket as master.
I need to replace the value of the integer sum with the value of Starting_Sequence_Number__c from the parent run. The for loop will then take the new value of sum and update the value of Starting_Sequence_Number__c back to the parent.
I have seen code like this to pull info from a parent just not sure how to assign it to a integer.
List<ParentObject> List = [SELECT Name, Id FROM ChildRecord WHERE ParentObject__c IN : trigger.newMap.keySet();
trigger SAP_Seq_Number on FX5__Ticket_Item__c (Before insert) {
integer sum = 10;
for(integer i= 0;i<Trigger.new.size();i++){
sum = i *10;
Trigger.new[i].SAP_Sequence_Number__c = sum;
}
}
Starting_Sequence_Number__c
on the parent records?