• Rohit Kumawat
  • NEWBIE
  • 75 Points
  • Member since 2018

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 10
    Replies
Hi All,

I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a field called Customer Number in Accounts. 

By using Sites i am storing a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).

Please help me out from thiss.

""When ever a Record is created in BookingLink Object, by using Customer Number it need to update the Account name and Owner of the record"". 

Thanks and Regards,
Azar Khasim.
I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a field called Customer Number in Accounts. 

By using Sites i am storing as a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).


Please help me out from thiss.

""When ever a Record is created in BookingLink Object, by using Customer Number it need to update the Account name and Owner of the record"". 
Can I assume that every SObject will have a name field as the minimum ?
Hi All,

I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a field called Customer Number in Accounts. 

By using Sites i am storing a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).

Please help me out from thiss.

""When ever a Record is created in BookingLink Object, by using Customer Number it need to update the Account name and Owner of the record"". 

Thanks and Regards,
Azar Khasim.
I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a field called Customer Number in Accounts. 

By using Sites i am storing as a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).


Please help me out from thiss.

""When ever a Record is created in BookingLink Object, by using Customer Number it need to update the Account name and Owner of the record"". 
Hi Everyone I have three Custom Objects 
CustomObj A
Custom Obj B
Custom Obj C

CustomObj A is the lookup on Custom Obj B and Custom Obj C 
But Custom Obj B and Custom Obj C in between there is no relation between us Now My Requirement is there is a Number fields on Custom Obj B and Custom Obj C  I want to SumUp of both these fields and Populate on CustomObj A So How to achieve this requirement Please tell me
Hi All,

I want to display number of contacts associated with an account using triggers.

for this I had created a lookup field like noofcontacts__c in account  object. and Wrote code as

trigger numberofcontacts on contact(after insert, after update, after delete) {
    Map<Id, List<Contact>> AcctContactList = new Map<Id, List<Contact>>();
    Set<Id> AcctIds = new Set<Id>();   
    List<schema.Account> AcctList = new List<schema.Account>();
    List<schema.Contact> ConList = new List<schema.Contact>();
   
    if(trigger.isInsert || trigger.isUPdate) {
        for(Contact Con : trigger.New) {
            if(String.isNotBlank(Con.AccountId)){
                AcctIds.add(Con.AccountId); 
            }  
        } 
    }
   
    if(trigger.isDelete) {
        for(Contact Con : trigger.Old) {
            AcctIds.add(Con.AccountId);    
        } 
    }          
   
    if(AcctIds.size() > 0){
        ConList = [SELECT Id, AccountId FROM Contact WHERE AccountId IN : AcctIds];
       
        for(Contact Con : ConList) {
            if(!AcctContactList.containsKey(Con.AccountId)){
                AcctContactList.put(Con.AccountId, new List<Contact>());
            }
            AcctContactList.get(Con.AccountId).add(Con);     
        }                          
      
           
        AcctList = [SELECT noofContacts__c FROM Account WHERE Id IN : AcctIds];
        for(Account Acc : AcctList) {
            List<schema.Contact> ContList = new List<schema.Contact>();
            ContList = AcctContactList.get(Acc.Id);
            Acc.Number_of_Contacts__c = ContList.size();
        }   
       
      
        update AcctList;   
    }

}
 I am   getting an error as "Variable doesnot exist:id".

Kindly support and suggest.

Thanks