• salesforce User 15
  • NEWBIE
  • 10 Points
  • Member since 2014

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

Hi!
I cannot build this with workflow, so I will need a trigger built to do the following:

Create a task record on the Case object when a Case record is created with Record Type and Account Name is not Null

Hi All,

Can any one help me to find the best way to accomplish this requirement?

When a parent Object record is created I have to populate 5 child object records. By using Apex trigger I can do this or I have to develop a VF page? Please guide me on this. Thanks in advance!!!
When a parent record is created how to automatically create 5 child records of different types? Can any one help me how to develope this. Should I have to use apex trigger? any thing else to create these child records?

 can any one help me for writing test class for this..

public class vW_Contract_Attachment{

     public  vW_Contracts_and_Legal_Attachment__c vWDoc{get;set;}
      public Attachment attachContract {get;set;} 
       List<Account> acc;        
    
               public vW_Contract_Attachment(ApexPages.StandardController stdController) {
                            acc = [Select Id, Name From Account Limit 1];
                           
                       attachContract = new Attachment();
                 
                      vWDoc = (vW_Contracts_and_Legal_Attachment__c)stdController.getRecord();
                                                                  
                                                                    }
    
      public PageReference saveAttachment(){  
               vWDoc.Size__c = String.valueOf(attachContract.bodyLength/1024)+'KB';
                           
                               insert vWDoc;
                               attachContract.ParentId =vWDoc.Id;
                               insert attachContract;
                   
                PageReference nextPage = new PageReference('/' + vWDoc.Id);
                  return nextPage;     
                   }
   }

 public class ContractAttachment{

      public Contract_Document__c vWDoc{get;set;}
     public Attachment attachContract {get;set;} 
      
     public Account acct;

      public ContractAttachment(ApexPages.StandardController stdController) {
               
                 acct = [SELECT Id, Name,RecordTypeId FROM Account WHERE Id = '001f000000gwjoO'];
                 RecordType rt =[Select Id,Name From RecordType Where SobjectType='Account' and Id ='012E00000001vtF'];
                 acct.RecordTypeId = rt.Id;              
               
                 attachContract = new Attachment();
                 vWDoc = new Contract_Document__c();
                 this.vWDoc = (Contract_Document__c)stdController.getRecord();
                 acct.Id = vWDoc.Id;       
                      }
             
    
      public PageReference saveAttachment(){  
                          
                vWDoc.Size__c = String.valueOf(attachContract.bodyLength/1024)+'KB';
                insert vWDoc;
               
                attachContract.ParentId =vWDoc.Id;
                insert attachContract;
                    
       PageReference nextPage = new PageReference('/' + vWDoc.Id);
         return nextPage;     
                   }
      
     }

The custom object Contract_Document__c is not seen in the Account Object. any suggestion?

 

Hi!
I cannot build this with workflow, so I will need a trigger built to do the following:

Create a task record on the Case object when a Case record is created with Record Type and Account Name is not Null

Hi Guys

I'm preparing myself for the Dev401 certification and following the workbooks provided by the salesforce. Don't know what kind of questions for that I have to prepare myself? I'm able to create basic application and have good understanding. Still I'm confused that I don't know the internals as the questions will be in the exam where they will not ask how to create an object, relationships etc.. Give me some tips and guide me towards the right track. I have to get it done as soon as possible. Please help.

Thanks.

 can any one help me for writing test class for this..

public class vW_Contract_Attachment{

     public  vW_Contracts_and_Legal_Attachment__c vWDoc{get;set;}
      public Attachment attachContract {get;set;} 
       List<Account> acc;        
    
               public vW_Contract_Attachment(ApexPages.StandardController stdController) {
                            acc = [Select Id, Name From Account Limit 1];
                           
                       attachContract = new Attachment();
                 
                      vWDoc = (vW_Contracts_and_Legal_Attachment__c)stdController.getRecord();
                                                                  
                                                                    }
    
      public PageReference saveAttachment(){  
               vWDoc.Size__c = String.valueOf(attachContract.bodyLength/1024)+'KB';
                           
                               insert vWDoc;
                               attachContract.ParentId =vWDoc.Id;
                               insert attachContract;
                   
                PageReference nextPage = new PageReference('/' + vWDoc.Id);
                  return nextPage;     
                   }
   }

 public class ContractAttachment{

      public Contract_Document__c vWDoc{get;set;}
     public Attachment attachContract {get;set;} 
      
     public Account acct;

      public ContractAttachment(ApexPages.StandardController stdController) {
               
                 acct = [SELECT Id, Name,RecordTypeId FROM Account WHERE Id = '001f000000gwjoO'];
                 RecordType rt =[Select Id,Name From RecordType Where SobjectType='Account' and Id ='012E00000001vtF'];
                 acct.RecordTypeId = rt.Id;              
               
                 attachContract = new Attachment();
                 vWDoc = new Contract_Document__c();
                 this.vWDoc = (Contract_Document__c)stdController.getRecord();
                 acct.Id = vWDoc.Id;       
                      }
             
    
      public PageReference saveAttachment(){  
                          
                vWDoc.Size__c = String.valueOf(attachContract.bodyLength/1024)+'KB';
                insert vWDoc;
               
                attachContract.ParentId =vWDoc.Id;
                insert attachContract;
                    
       PageReference nextPage = new PageReference('/' + vWDoc.Id);
         return nextPage;     
                   }
      
     }

The custom object Contract_Document__c is not seen in the Account Object. any suggestion?