function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
renu anamalla 9renu anamalla 9 

How to update and delete the record using Triggers

How to update and delete the record using Triggers?
Im new for salesforce.
I have one custom object JobForm__c
i have two fields ApplicaneName__c,JobFormName(mandatory)
I have applicant name='renu'
i want arjun.
sandhya reddy 10sandhya reddy 10
Hi Renu,

please go through the below link to get idea in trigger.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm

For you requirement below is code for delete on opportunity standard object where opportunity name is sandhya

u can use your custom object instead.

 
trigger DeleteOpp on Opportunity(after insert, after update) {
 List<Id> lstId = new List<Id>();
 
for(Opportunity opp: Trigger.old){
        List<Opportunity> existoppList = [Select Id from Opportunity where Name =:'sandhya'];
        delete existoppList;
    }
 
}
 
trigger updateacc on Account (before update) {
    for (Account updatedAccount : Trigger.new) {
                updatedAccount.name = 'arjun';

    }
}

Please let us know if this helps you.

Thanks and Regards
sandhya
 
renu anamalla 9renu anamalla 9
Thank you ....nice programmaer