You need to sign in to do that
Don't have an account?
tns
Restrict non-administrators from deleting certain Contacts
Without using Record Types or Apex or Visual Force, does anyone have any ideas on how to restrict non-admin users from deleting Contacts that contain a value in a custom field that holds a Unique Id from an external system on the Contact record? It woudl be OK for users to delete a Contact that does not contain this unique id.
You can't do it without using either record types or an Apex trigger.
Ok, thanks. If I use an Apex trigger (I have no expeience whatsoever with this), how would I set that up?
You'll need to learn to write Apex code:
http://wiki.developerforce.com/index.php/Documentation#Getting_Started
or you could hire someone to do it:
http://sites.force.com/appexchange/browse?type=Services
Hi,
Create another page layout without Delete button. Create Record Type and assign this page layout.
Using Workflow field update assign this page layout using record type and with the condition Unique Field is Not Equals to null.
Thanks,
Kodisana
Find below asample code for non admin users for deleting a specific contact :
trigger dontdelacc on contact(before delete)
{
system.debug('############ ' + Trigger.old[0].id);
try
{
if(trigger.new.size()==1)
{
if([select Id from Profile where name = 'Partner Staff'].id == UserInfo.getProfileId())
{
// process your data
List<Contact> con = [select AccountId from Contact where AccountId=:Trigger.old[0].id];
if(con.size()>0)
{
Trigger.old[0].id.addError('You cannot delete this ');
}
}
}
}
catch(Exception e){}
}
Hope this helps.