Trigger
Trigger
account name.
3) When ever lead is created with LeadSource as Web then give rating as cold
otherwise hot.
4) Whenever a case is created with origin as email then set status as new and
priority as medium
Trigger Casecret on Case(before insert){
for(Case cret : trigger.new){
if(cret.Case Origin == 'Email'){
cret.Status='New';
cret.Priority='Medium';
}
}
}
5)When ever the Account is created with Industry as Banking then create a contact
for account, Contact Lastname as Account name and contact phone as account phone.
6)The following Trigger will fires when we try to create the account with the same
name i.e. Preventing the users to create Duplicate Accounts
7)The following trigger describes when the leads are inserted into the database it
would add Doctor prefixed for all lead names. This is applicable for both inserting
and updating the lead records.
whenever u have to check the old and new value we use TriggerHandler
trigger accountUpdate on Account(after Update){
if(trigger.isUpdate && trigger.isAfter){
Account.TriggerHandler(createOpportunity);
}}
class
9) prevent account deletion when there is primary contact under account can't
understand but use trigger handler
10)Throw an error whenever the user try to delete the contact which is not
associated to account
11)Create a field called "Contact Relationship" checkbox on the contact object and
create the object called "Contact Relationship" which is related list to the
Contacts (Lookup Relationship).
Now build a logic when we create contact by checking Contact Relationship checkbox,
then contact Relationship will be created automatically for that contact.
13)The following trigger updates the field called “Hello” by the value
“World”whenever we are creating an account or updating an account record. Create
the field called “Hello” on the Account Object (Data Type = Text)