You need to sign in to do that
Don't have an account?
Samadhan Sakhale 3
Copy single field records from one object on another
hi,
i have to copy one field all records(Which is already Stored)from custom object to Standard object by creating field on standard Object.
Anyone please tell me example of scheduling this type of job.
thanks,
Sam
i have to copy one field all records(Which is already Stored)from custom object to Standard object by creating field on standard Object.
Anyone please tell me example of scheduling this type of job.
thanks,
Sam
Hope this will help you.
All Answers
Can you please give any example which shows the batch class those copy address field record from contact and store onto the Account table by using it's ID's.
Thanks.
Sam
Hope this will help you.
But it Gives error 'Arguement must be an object that implements database.batchable'
so tell me the solution.
regards,
Sam
And schedule this batch.
Database.executeBatch(new CopyAccPhoneToContPhone_Batch ()) ;
I am trying to copy all cities from Student custom object in Address1 custom object into City__c field.all code working properly and code coverage also 100%
but the problem is that after running program cities not copied in Address table and i also trying to check program execution using System.Debug(''); but the statement not printed after executon in log my Code is here
global class CopyStudtoAdr_Batch implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query='SELECT ID,City__c FROM Student__c';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Student__c> scope)
{
System.debug('Batch Class Started....');
//List<Address1__c> adrToUpdate = [Select id,StudentID__c,City__c from Address1__c where StudentID__c in : scope] ;
//Set<String> setSturdentIds = new Set<String>();
List<Address1__c> adrToUpdate = [Select Id,StudentID__c,City__c from Address1__c where StudentID__c in : Scope];
Map<ID,Student__c> stdMap = new Map<ID,Student__c>(scope) ;
// Loop to copy account Student to Address phone
for(Address1__c adr : adrToUpdate)
{
adr.City__c = stdMap.get(adr.StudentID__c).City__c ;
}
if(adrToUpdate.size() > 0)
update adrToUpdate;
}
global void finish(Database.BatchableContext ctx)
{}
}
Please check it and tell me Solution
Thanks,
Sam