You need to sign in to do that
Don't have an account?
Peter Cowen
how to match fields
i have two objects with bug number on
Case
Service Request
I would like to create a trigger so that once a case is updated with the bug number and the bug number is in Service Request it populates the Service Request field on case.
I have no idea how I can set the trigger so if a case is created or updated with a bug number it looks at service request to see if a active service request has that bug number and it will need to do the same when a service request is created it searchs the cases for that bug number and fills in the service request field.
Case
Service Request
I would like to create a trigger so that once a case is updated with the bug number and the bug number is in Service Request it populates the Service Request field on case.
I have no idea how I can set the trigger so if a case is created or updated with a bug number it looks at service request to see if a active service request has that bug number and it will need to do the same when a service request is created it searchs the cases for that bug number and fills in the service request field.
We need to write two triggers here: one on Case and other on Service Request.
Case trigger:
if(trigger.isBefore && trigger.isUpdate){
If(oldCase.bugNumber == null and newCase.bugNumber != null){
write code to query service request where bugNumber = newCase.bugNumber;
if record is found, then populates the Service Request field on case.
}
}
Same logic is applicable for Service trigger too.
Thanks,
Nirmala