• Salesforce_user007
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 14
    Replies

Suppose i have two object 

     1.Account- standard object[it has a field name Status__c which is a picklist having value inprogress and closed]

     2.Client__c - custom object[it also have same field name Status__c which is a picklist having value inprogress and closed]

 

and Client__c has lookup to Account name which means Account has a related list of client object .

 

My question is :

    I want to write a trigger where if i put account status to "closed"  i can not put client status to "closed",it should throw an error message on client object or if i put client status to closed i can not put account status to closed vice versa.

 

Can any one please help me to write a trigger on this??

 

Thanks in advance.

 

 i hav written a trigger ,can anyone help to write the test class:

 

trigger Industry on Account (after update) {
            
    List<Account> clientList = new List<Account>();
       
       for(Account a: Trigger.New){
        if((Trigger.oldMap.get(a.Id).Indus<> Trigger.newMap.get(a.Id).Indus ||
           (Trigger.oldMap.get(a.Id).S__c <> Trigger.newMap.get(a.Id).S__c) 
                  {
                clientList.add(a);
        }   
    }  
    if(!clientList.isEmpty()){         
             updateIndustry.industrySector(clientList);  
      }
   
}

 

Thanks.

Suppose i have two object 

     1.Account- standard object[it has a field name Status__c which is a picklist having value inprogress and closed]

     2.Client__c - custom object[it also have same field name Status__c which is a picklist having value inprogress and closed]

 

and Client__c has lookup to Account name which means Account has a related list of client object .

 

My question is :

    I want to write a trigger where if i put account status to "closed"  i can not put client status to "closed",it should throw an error message on client object or if i put client status to closed i can not put account status to closed vice versa.

 

Can any one please help me to write a trigger on this??

 

Thanks in advance.

 

 i hav written a trigger ,can anyone help to write the test class:

 

trigger Industry on Account (after update) {
            
    List<Account> clientList = new List<Account>();
       
       for(Account a: Trigger.New){
        if((Trigger.oldMap.get(a.Id).Indus<> Trigger.newMap.get(a.Id).Indus ||
           (Trigger.oldMap.get(a.Id).S__c <> Trigger.newMap.get(a.Id).S__c) 
                  {
                clientList.add(a);
        }   
    }  
    if(!clientList.isEmpty()){         
             updateIndustry.industrySector(clientList);  
      }
   
}

 

Thanks.

I am trying to add Opportunity Sales Team through Apex. Trigger works fine except "OpportunityAccessLevel" field.

Here is the error : Field is not writeable: OpportunityAccessLevel

If I insert the record without specifying the OpportunityAccessLevel = 'Read/Write'  , default values is getting assigned as OpportunityAccessLevel = 'Read Only'.  I need to assign value OpportunityAccessLevel = 'Read/Write' while adding sales team member.

Any workaround ?

Thanks

Pramod

  • March 24, 2008
  • Like
  • 0