• Ankita dixit
  • NEWBIE
  • 20 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
There are 2 Objects: 1 is master and 2 is child.Master is having full access but child is not having any acess. then how will you give acess to child object?
inserting opp records want name of the opportunity records, its has to be name and whatever name given to that opp.
Account - opportunities = lookup relationship

Suppose there is Account and we need to calculate how many new opportunities created in the month of September?

how to write SOQL and trigger? Please help !!
What is this type of error means: what is possible solution?
trigger ApexTrigger10 on Contact (After insert,After Delete) {
    
    set<id> contactSet = new set<id>();
    List<Account> newAccountList = new List<Account>();
    
    if(trigger.isInsert && trigger.isAfter){
        for(Contact con:trigger.new){
            contactSet.add(con.Account);
         }
    }

    if(trigger.isDelete && trigger.isAfter){
        for(Contact con:trigger.old){
            contactSet.add(con.Account);
         }
    }
    List<Account> Acc= [SELECT id, name,(SELECT id,name from contacts) FROM Account WHERE id IN:contactSet];
    for( Account a : Acc)
    {
        a.Total_number_of_contacts__c= a.contacts.size();
        newAccountList.add(a);
    }
    update newAccountList;
}
 
inserting opp records want name of the opportunity records, its has to be name and whatever name given to that opp.
Account - opportunities = lookup relationship

Suppose there is Account and we need to calculate how many new opportunities created in the month of September?

how to write SOQL and trigger? Please help !!
What is this type of error means: what is possible solution?
trigger ApexTrigger10 on Contact (After insert,After Delete) {
    
    set<id> contactSet = new set<id>();
    List<Account> newAccountList = new List<Account>();
    
    if(trigger.isInsert && trigger.isAfter){
        for(Contact con:trigger.new){
            contactSet.add(con.Account);
         }
    }

    if(trigger.isDelete && trigger.isAfter){
        for(Contact con:trigger.old){
            contactSet.add(con.Account);
         }
    }
    List<Account> Acc= [SELECT id, name,(SELECT id,name from contacts) FROM Account WHERE id IN:contactSet];
    for( Account a : Acc)
    {
        a.Total_number_of_contacts__c= a.contacts.size();
        newAccountList.add(a);
    }
    update newAccountList;
}