You need to sign in to do that
Don't have an account?
mukesh gupta
delete record by trigger
Hi Expert,
I am using a trigger that will fire to delete any record but when record delete then new screen appears
"The record you attempted to access has been deleted. The user who deleted this record may be able to recover it from the Recycle Bin. Deleted data is stored in the Recycle Bin for 15 days."
But here i don't need this message.
Can any one plesae suggest.
Thanks
Mukesh
I am using a trigger that will fire to delete any record but when record delete then new screen appears
"The record you attempted to access has been deleted. The user who deleted this record may be able to recover it from the Recycle Bin. Deleted data is stored in the Recycle Bin for 15 days."
But here i don't need this message.
Can any one plesae suggest.
Thanks
Mukesh
As per this understanding., please see below Trigger:
Try this and let me know if this is what you are looking for.
Best Regards,
BALAJI
All Answers
I think after deleting the record in the Trigger, might be you are trying to do some modification on the record in the trigger.
Please check in the trigger if there are any actions performing on the recrod after the delete DML.
Best Regards,
BALAJI
Thanks
Mueksh
If you can share your trigger, we can try to troubleshoot.
I want to update existing contact whose email Id is same with existing contact. afetr match the email with old to new then update contact.
this is below code :-
Trigger NewContact on Contact (before insert) {
Set<Id> con = new Set<Id>();
List<Contact> cont = new List<Contact>();
for (Contact c : Trigger.New) {
con.add(c.id);
}
List<Contact> existing_contact = [SELECT Id,Email,Phone,Title
FROM Contact
WHERE Email IN :con];
if(existing_contact.size() > 0) {
for (Contact c : existing_contact) {
// c.Phone = Trigger.New[0].Phone;
//c.Title = Trigger.New[0].Title;
// cont.add(c);
}
//update cont;
}
}
As per this understanding., please see below Trigger:
Try this and let me know if this is what you are looking for.
Best Regards,
BALAJI
One more thing about this trigger is that, i not want to delete existing contact, but update with new contact with email, meand contact will not delete only update with existing if email id is same.
waiting for possitive reply
Many Thanks
Mukesh
So, you mean to say that Existing Contact's values should be updated with New Contact's values and no need to delete Existing Contact. Right ??
Thanks
Mukesh