+ Start a Discussion
tganikumartganikumar 

When we create one Project then automatically some tasks will create ? is this possible?

Hi 

 

I have two custom objects like Projects and Tasks, then i have the project lookup in tasks object. But Whenever i create one project means(Quality of Project) the particular tasks will create automatically (

  • Bug Fixes
  • Communication
  • Configuration
  • Data Conversion
  • Defect Resolution
  • Deployment
  • Design
  • Development
  • Development Review
  • Documentation
  • Graphic Design
  • Meetings
  • Planning
  • R&D
  • Requirements
  • Testing
  • Training

). These are tasks when i create one project and also i will create another tasks my own. But these tasks are default to every project. 

 Is this possible with trigger or anything else? 

 

Please give the answer as soon as possible?

Best Answer chosen by Admin (Salesforce Developers) 
JitendraJitendra

Yea, 

 

You can do this very easily using After Insert Trigger on Project Object.

 

Please refer below link to see how trigger can be created :

 

http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%E2%80%93-creating-trigger-and-test-cases-%E2%80%93-6-of-6/

All Answers

JitendraJitendra

Yea, 

 

You can do this very easily using After Insert Trigger on Project Object.

 

Please refer below link to see how trigger can be created :

 

http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%E2%80%93-creating-trigger-and-test-cases-%E2%80%93-6-of-6/

This was selected as the best answer
tganikumartganikumar

Hi Jitendra, 

 

I will give my custom object api names. Can you please give the solution to me. I want urgent solution. Please

 

Project Object: Projects__c 

Tasks Object : Tasks__c

 

please give me hte exact trigger for this...?

 

 

thanks

ganesh

JitendraJitendra

Please try below Trigger :

trigger createTask on Projects__c  (after insert) {

       Projects__c[] projectList = Trigger.new;
	   List<Tasks__c> tskList = new List<Tasks__c>();
	   for(Projects__c prj : projectList)
	   {
	      Tasks__c t = new Tasks__c();
		  //Here, populate values in object "t"
		  tskList.add(t);
	   }
	   
	   insert(tskList);
}