You need to sign in to do that
Don't have an account?

How to Create a same task on other Object
Hai all
Can any one Explain me how to create a same task on the Other Custom Object automatically??
Here is my Requirement
I have one custom Object Retailer__c and custom Button on Retailer Object Take Order once we click on it A task should be created on retailer and same task should be created on Account for me now task is creating on both account and retailer but fileds are not mapping can any 1 help me out here is my code:
Public PageReference Save()
{
odd.Distributor__c=acc.Id;
odd.Retailer__c=ret.id;
Insert odd;
task1.Subject='Order/Visit' ;
task1.Status__c='Order Taken';
task1.Whatid=ret.id;
task1.Date__c=odd.Order_Date__c;
task1.Comments__c=ret.Comments__c;
task1.Country__c=ret.Billing_Country__c;
task1.State__c= ret.Billing_State__c;
task1.City__c=ret.Billing_City__c;
task1.Street__c=ret.Billing_Street__c;
task1.Zip_Postal_Code__c=ret.Billing_Zip_Postal_Code__c;
task1.Province__c=ret.Billing_Province__c;
Insert task1;
task2.Whatid=acc.id;
Insert task2;
Can any one Explain me how to create a same task on the Other Custom Object automatically??
Here is my Requirement
I have one custom Object Retailer__c and custom Button on Retailer Object Take Order once we click on it A task should be created on retailer and same task should be created on Account for me now task is creating on both account and retailer but fileds are not mapping can any 1 help me out here is my code:
Public PageReference Save()
{
odd.Distributor__c=acc.Id;
odd.Retailer__c=ret.id;
Insert odd;
task1.Subject='Order/Visit' ;
task1.Status__c='Order Taken';
task1.Whatid=ret.id;
task1.Date__c=odd.Order_Date__c;
task1.Comments__c=ret.Comments__c;
task1.Country__c=ret.Billing_Country__c;
task1.State__c= ret.Billing_State__c;
task1.City__c=ret.Billing_City__c;
task1.Street__c=ret.Billing_Street__c;
task1.Zip_Postal_Code__c=ret.Billing_Zip_Postal_Code__c;
task1.Province__c=ret.Billing_Province__c;
Insert task1;
task2.Whatid=acc.id;
Insert task2;
This code is not ideal but it will do what you want. What you should really have is a utility method that takes in a subject, status, Id, an odd and a ret (whatever those are) and generates a task. That would turn your code into this.
You'll need to update Odd__c and Ret__c to be whatever they really are.
NOTE: This code has not been tested and may contain typographical or logical errors.