You need to sign in to do that
Don't have an account?
Sridhar Bonagiri
How to restrict a particular type of record
Hi All,
I have records in contacts object which are having two types of 'contact type' like 'CEO' and 'Manager',
i don't want users to delete the contact records which are of 'CEO' , this can be achieved through trigger, but i want to show custom message in the page.
how can this achieved.
thanks in advance.
Hi, I just coded a very similar example the other day... it throws a custom error message when a user attempts to approve a record without filling in some fields on the record first. The error message is the part I wanted to share... try adding that line to your code and see what it looks like (should display at the top of the record). Obviously, you will want a 'before delete' trigger type.
trigger questionnaireEnforcer on Deal_Registration__c (before Update) { for(Deal_Registration__c dr : Trigger.New){ // enforces that the questionnaire is populated before approval if(dr.approval_status__c.contains('Approved') && dr.Questionnaire_Completed__c=='No'){ dr.addError('You must complete the Internal Questionnaire in order to approve this record, to do this click \'Edit\' on the record.'); } } }
All Answers
Hi, I just coded a very similar example the other day... it throws a custom error message when a user attempts to approve a record without filling in some fields on the record first. The error message is the part I wanted to share... try adding that line to your code and see what it looks like (should display at the top of the record). Obviously, you will want a 'before delete' trigger type.
trigger questionnaireEnforcer on Deal_Registration__c (before Update) { for(Deal_Registration__c dr : Trigger.New){ // enforces that the questionnaire is populated before approval if(dr.approval_status__c.contains('Approved') && dr.Questionnaire_Completed__c=='No'){ dr.addError('You must complete the Internal Questionnaire in order to approve this record, to do this click \'Edit\' on the record.'); } } }
Of Course,
You can add like
contact.type.addError('You cant delete the Record');
thanks for quick reqply
can we add a custom message and can we able to get this message when we are delete the record using the delete link from related list