Hello everyone, I'm stuck on some code logic regarding an insert of a new Case, but also inserting a new Item__c (custom object) record which is associated with the case.
The logic looks something like this: A Case record has it's status changed, this triggers a new Case record to be created. The initial Case record has an Item__c related/associated with it. The new case record that gets created also has an Item__c record associated to it and this records field/s should contain the same data as the previous Item__c associated to the the initial Case. How do I get this association between the records when querying and also when inserting into the database, how do I make sure the record of Item__c type is associated with the newly inserted Case record?
#Apex #Apex Class #SOQL Queries #Custom Objects #Salesforce Developer
You can create a lookup relationship field on Item__c to Case and then configure the trigger accordingly to your needs.
For example, to make it fire upon Case object updates and subsequently create an Item object.
Sincerely,
Mykhailo Vdovychenko
Bringing Cloud Excellence with IBVCLOUD OÜ