You need to sign in to do that
Don't have an account?
golla Anitha
When duplicates are found on Leads, then the user of profile ‘FCL-Sales’ should be able to merge leads only of record type ‘FCL-Sales’. Schedule it every 2 hrs.
When duplicates are found on Leads, then the user of profile ‘FCL-Sales’ should be able to merge leads only of record type ‘FCL-Sales’. Schedule it every 2 hrs.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
global class leaduserprofile implements
Database.Batchable<sObject>, Database.Stateful {
global Integer recordsProcessed = 0;
global Database.QueryLocator start(Database.BatchableContext bc)
{
return database.getQueryLocator(' Select email, RecordType.Name,count(id) FROM lead WHERE recordtypeid in (Select Id From RecordType where sobjecttype in: lead and DeveloperName IN : fcl_service)GROUP BY email,RecordType.Name ');
}
public void execute(database.BatchableContext bc,List<lead> scope)
{
List<lead> ld=new list<lead>();
system.debug('scope'+scope);
map<string,List<lead>> mapping=new map<string,List<lead>>();
for(lead ld1:scope)
{
ld.add(ld1);
system.debug('ld'+ld);
mapping.put(ld1.Email,ld);
system.debug('mapping'+mapping);
for(integer i=mapping.size();i>0;i--)
{
merge ld1 ld[i] ;
system.debug('ld1'+ld1);
recordsProcessed = recordsProcessed + 1;
}}
update ld;
}
public void finish(database.BatchableContext bc)
{
System.debug(recordsProcessed + ' records processed. Shazam!');
AsyncApexJob job = [SELECT Id, Status, NumberOfErrors,
JobItemsProcessed,
TotalJobItems, CreatedBy.Email
FROM AsyncApexJob
WHERE Id = :bc.getJobId()];
}
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
can you please help on this
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
global class leaduserprofile implements
Database.Batchable<sObject>, Database.Stateful {
global Integer recordsProcessed = 0;
global Database.QueryLocator start(Database.BatchableContext bc)
{
return database.getQueryLocator(' Select email, RecordType.Name,count(id) FROM lead WHERE recordtypeid in (Select Id From RecordType where sobjecttype in: lead and DeveloperName IN : fcl_service)GROUP BY email,RecordType.Name ');
}
public void execute(database.BatchableContext bc,List<lead> scope)
{
List<lead> ld=new list<lead>();
system.debug('scope'+scope);
map<string,List<lead>> mapping=new map<string,List<lead>>();
for(lead ld1:scope)
{
ld.add(ld1);
system.debug('ld'+ld);
mapping.put(ld1.Email,ld);
system.debug('mapping'+mapping);
for(integer i=mapping.size();i>0;i--)
{
merge ld1 ld[i] ;
system.debug('ld1'+ld1);
recordsProcessed = recordsProcessed + 1;
}}
update ld;
}
public void finish(database.BatchableContext bc)
{
System.debug(recordsProcessed + ' records processed. Shazam!');
AsyncApexJob job = [SELECT Id, Status, NumberOfErrors,
JobItemsProcessed,
TotalJobItems, CreatedBy.Email
FROM AsyncApexJob
WHERE Id = :bc.getJobId()];
}
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
can you please help on this
Hi Golla,
May I know what is the error you are getting ?
Regards,
Priya Ranjan