You need to sign in to do that
Don't have an account?
Gespitz
Create a case trigger
Hi everybody,
I need some help with this. I need to developed a trigger that would create a case when a custom object status changes, and give this case the contact and the custom object ID to related them. Any help on this?
Regards,
German
Hi,
Firstly you have to create the relationship between case and your custom object. Create a lookup Field in case object with your custom object.
Use below code snippets as reference
trigger createcase on Broker__c (after update)
{
if(trigger.new[0].status!=trigger.old[0].status)
{
case c=new case(ContactId=trigger.new[0].contact,subject='new Case',Broker__c=trigger.new[0].id,Status='new',Origin='Phone');
insert c;
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.