• thomsant
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 8
    Replies

We have a migration and below is the class  causing issue because of code coverage  . I have attached the test class to.

Help really  appreciated as its very urgent  

 

 global class Migrate_Account_Class_Batch implements Schedulable


  global void execute(SchedulableContext sc)
  { 
     // query to get the lastupdate date from the Custom Settings - MigrationDate
     
     MigrationDate__c MigDt =[SELECT Id,LastUpdateDate__c FROM MigrationDate__c where Name like 'Account%' order by LastUpdateDate__c desc Limit 1];
     
     if(MigDt <> null)
     {
         DateTime Dt = MigDt.LastUpdateDate__c;
         List<Accountaccounts = [Select Id ,EMC_Match__cDUNS_Match__c from Account where LastModifiedDate > :Dt AND (EMC_Match__c = true OR DUNS_Match__c = true)];
    
         //inset a new entry in the Custom Setting - MigrationDate
         MigrationDate__c mg = new MigrationDate__c(Name='Account'+ System.now(),LastUpdateDate__c=System.Today());
         insert mg;  
        
        // Define connection id 
        Id networkId = ConnectionHelper.getConnectionId('Hartford Life GBD'); 
        
        //  System.debug('After networkId');
         
        Set<IdlocalAccountSet = new Set<Id>(); 
        List<AccountlocalAccounts = new List<Account>();
        
        // only share records created in this orgdo not add accounts received from another org
        for (Account newAccounts : accounts )
         {
          System.Debug('EMC: ' + newAccounts.EMC_Match__c + ', Duns:' + newAccounts.DUNS_Match__c ); 
           if  (newAccounts.Id != null && (newAccounts.EMC_Match__c == true || newAccounts.DUNS_Match__c == true )) 
             
            { 
                localAccountSet.add(newAccounts.Id);
                //  System.Debug('Size: '+localAccountSet.size()+', Id:' + newAccounts.Id); 
                localAccounts.add(newAccounts); 
              }     
            }
                if (localAccountSet.size() > 0)
                { 
                //    System.debug('Before Partner Network');   
                List<PartnerNetworkRecordConnectionaccountConnections =  new  List<PartnerNetworkRecordConnection>(); 
                
                for (Account newAccount : localAccounts) { 
                  if (localAccountSet.contains(newAccount.Id)) 
                  { 
                       PartnerNetworkRecordConnection newConnection = 
                          new PartnerNetworkRecordConnection
                              ConnectionId = networkId
                              LocalRecordId = newAccount.Id
                              SendClosedTasks = false
                              SendOpenTasks = false
                              SendEmails = false,
                              RelatedRecords = 'Location_Assignment__c'); 
                              accountConnections.add(newConnection); 
                             //  System.Debug('Network Id: '+networkId+', Account Id:' + newAccount.Id+', Related:' + newConnection.RelatedRecords); 
                    } 
                } 
                if (accountConnections.size() > 0 ) 
                { 
                       database.insert(accountConnections); 
                       System.debug('After Database commit');
                     
                      //    Migrate_LocAssign_Class_Batch LocAssign = new Migrate_LocAssign_Class_Batch(); 
                      //    LocAssign.setPCLocAssign();
                }
        } 
        
    }  
 }
}

 

 

 

Hi

Is there a way to find out the user who last ran the report ?  The Administrative Reports does not have this detail

 

Tom

Hi All,

Need urgent help in writing a test class for the below controller  , not sure how i can do it .

Help really appreciated

 

Regards

Tom

 

 

public without sharing class RelatedListController{

    private list<sObject> mSObjects;
    public list<sObject> SObjects{
        get{return mSObjects;}
        set{
            numObjects = value==null||value.isEmpty() ? 0 : value.size();
            DescribeSObjectResult res = value.getsObjectType().getDescribe();
            isDeletable = res.isDeletable();
            isCreateable = res.isCreateable();
            isUpdateable = res.isUpdateable();
            defaultTitle = res.getLabelPlural();
            isActivity = res.getSObjectType()==Task.SObjectType||res.getSObjectType()==Event.SObjectType;
            map<String,Schema.SObjectField> fieldMap = res.fields.getMap();
            DescribeFieldResult fieldRes = isActivity ? fieldMap.get('Subject').getDescribe() : fieldMap.get('Name').getDescribe();
            nameLabel = fieldRes.getLabel();
            nameField = fieldRes.getName();
            keyPrefix = res.getKeyPrefix();
            mSObjects = value;
        }
    }
        
    private String defaultTitle;
    private String overrideTitle;
    
    public String parameters {
        get{return parameters==null ? '' : parameters;}
        set;}
    
    public String PageTitle{
        get{return overrideTitle==null||overrideTitle=='' ? defaultTitle : overrideTitle;}
        set{overrideTitle = value;}}
    
    public String buttonLabel{
        get{return overrideButton==null||overrideButton=='' ? String.format(System.Label.New_Button,new list<String>{PageTitle}) : overrideButton;}
        set{overrideButton = value;}}
    
    private String overrideButton;
    
    private integer numObjects;
    public integer rowIncrement{
        get{return numObjects-mRows<mRows ? numObjects-mRows : mRows;}}
    
    private integer mRows;
    public integer rows{
        get{
            if(mRows==null||mRows==0){
                mRows = numObjects<5 ? numObjects : 5;
            }
            return mRows;
        }
    }
    
    public String retURL{
        get{return retURL==null ? '' : 'retURL=' + retURL;}
        set;}
    
    public boolean noRecords{
        get{return numObjects==0;}}
    
    public boolean moreRows{
        get{return mRows<numObjects;}}
    
    public String keyPrefix {get;private set;}
    public String nameLabel {get;private set;}
    public String nameField {get;private set;}
    public boolean isActivity{get;private set;}
    public boolean isUpdateable{get;private set;}
    public boolean isDeletable{get;private set;}
    public boolean isCreateable{get;private set;}
    public ApexPages.PageReference newRecord(){
        return new ApexPages.PageReference('/' + keyprefix + '/e' + parameters);}
    
    public ApexPages.PageReference incrementRows(){
        mRows = mRows + rowIncrement;
        return null;}
}

Hi ,

 

Is there an easy way to pull the details of which all users have access to the reports?

 

Tom

Hi Need help to get the test class for the below controller .

 

Tom

 

public without sharing class RelAccExtn
{

    private list<Account> relacct;
    private Account acc;
    public boolean isCorrectRecordType
    {
        get{
             return new set<Id>{'012V00000000AQHIA2','01230000000npXrAAI'}.contains(acc.RecordTypeId);
           }
    }
    private list<Account> mRelatedAccounts;
    public list<Account> relatedAccounts{
        get {
            if (mRelatedAccounts==null) {
                mRelatedAccounts = new list<Account>();
                mRelatedAccounts.addAll([select AARP_Authorized_Agency__c,Account_Id__c,Account_No__c,
                Account__c,Agency_Business_Type__c,Agency_ID__c,Agency_Interest_Level__c,
                Agency_Loss_Notification__c,Agency_Model__c,Agency_Status__c,Agency__c,AIM__c,AnnualRevenue,
                Auto__c,A_Separate_Managed_Unit__c,BillingCity,BillingCountry,BillingPostalCode,BillingState,
                Marine_Region_Center__c,Marine_Underwriter_User__c,MARINE_UNDERWRITER__c,MasterRecordId,
                MM_Tech_Region_Center__c,MM_Tech_Underwriter_User__c,MM_TECH_UNDERWRITER__c,Monthly_Auto_Qt__c,
                Name,Nathometer__c,Needs_Batch_Processing__c,New_Accts_Under_25K__c,New_PL_WP__c,
                New_Sc_Count_25k__c,New_Sc_Count_75k__c,New_SC_WP_del__c,New__c,Non_Std__c,No_PL_Staff_Area__c,
                No__c,NumberOfEmployees,Number_of_Employees_del__c,Number_of_Producers__c,
              FROM Account where  ((EMC__c = :acc.EMC__c AND EMC__c != null) OR (DUNS_Nbr_Hdqtrs__c =:acc.DUNS_Nbr_Hdqtrs__c AND            DUNS_Nbr_Hdqtrs__c != null))
                  and Id != :acc.Id and Primary_Org__c != :acc.Primary_Org__c and RecordTypeId != :acc.RecordTypeId ]);
            }
            return mRelatedAccounts;
        }
    }
   
   public RelatedAccountExtension(ApexPages.StandardController std){
        std.addFields(new List<String>{'EMC__c','Type','DUNS_Nbr_Hdqtrs__c','Primary_Org__c','RecordTypeId'});
        this.acc = (Account)std.getRecord();
    }
}

Hi All,

Need urgent help in writing a test class for the below controller Class , not sure how i can do it .

Help really appreciated

 

Regards

Tom

 

 

public without sharing class RelatedListController{

    private list<sObject> mSObjects;
    public list<sObject> SObjects{
        get{return mSObjects;}
        set{
            numObjects = value==null||value.isEmpty() ? 0 : value.size();
            DescribeSObjectResult res = value.getsObjectType().getDescribe();
            isDeletable = res.isDeletable();
            isCreateable = res.isCreateable();
            isUpdateable = res.isUpdateable();
            defaultTitle = res.getLabelPlural();
            isActivity = res.getSObjectType()==Task.SObjectType||res.getSObjectType()==Event.SObjectType;
            map<String,Schema.SObjectField> fieldMap = res.fields.getMap();
            DescribeFieldResult fieldRes = isActivity ? fieldMap.get('Subject').getDescribe() : fieldMap.get('Name').getDescribe();
            nameLabel = fieldRes.getLabel();
            nameField = fieldRes.getName();
            keyPrefix = res.getKeyPrefix();
            mSObjects = value;
        }
    }
        
    private String defaultTitle;
    private String overrideTitle;
    
    public String parameters {
        get{return parameters==null ? '' : parameters;}
        set;}
    
    public String PageTitle{
        get{return overrideTitle==null||overrideTitle=='' ? defaultTitle : overrideTitle;}
        set{overrideTitle = value;}}
    
    public String buttonLabel{
        get{return overrideButton==null||overrideButton=='' ? String.format(System.Label.New_Button,new list<String>{PageTitle}) : overrideButton;}
        set{overrideButton = value;}}
    
    private String overrideButton;
    
    private integer numObjects;
    public integer rowIncrement{
        get{return numObjects-mRows<mRows ? numObjects-mRows : mRows;}}
    
    private integer mRows;
    public integer rows{
        get{
            if(mRows==null||mRows==0){
                mRows = numObjects<5 ? numObjects : 5;
            }
            return mRows;
        }
    }
    
    public String retURL{
        get{return retURL==null ? '' : 'retURL=' + retURL;}
        set;}
    
    public boolean noRecords{
        get{return numObjects==0;}}
    
    public boolean moreRows{
        get{return mRows<numObjects;}}
    
    public String keyPrefix {get;private set;}
    public String nameLabel {get;private set;}
    public String nameField {get;private set;}
    public boolean isActivity{get;private set;}
    public boolean isUpdateable{get;private set;}
    public boolean isDeletable{get;private set;}
    public boolean isCreateable{get;private set;}
    public ApexPages.PageReference newRecord(){
        return new ApexPages.PageReference('/' + keyprefix + '/e' + parameters);}
    
    public ApexPages.PageReference incrementRows(){
        mRows = mRows + rowIncrement;
        return null;}
}

I am trying to write a test class but i am  getting only 0% coverage , need help to get this fixed .Help appreciated.

 

 

 

global

class Migrate_LocAssign_Class_Batch implements Schedulable

 

{

 

 

globalvoid execute(SchedulableContext sc)

 

  {

 

     

MigrationDate__c MigDt =[SELECT Id,LastUpdateDate__c fromMigrationDate__cwhereNamelike'LocAssign%'orderby LastUpdateDate__c desc Limit 1];

      DateTime Dt = MigDt.LastUpdateDate__c;

      List<

Location_Assignment__c> location = [Select Id ,Account__c,Org_Unit__cfromLocation_Assignment__cwhere LastModifiedDate > :Dt];

     

      

//inset a new entry in the Custom Setting - MigrationDate

    

MigrationDate__c mg = newMigrationDate__c(Name='LocAssign'+ System.now(),LastUpdateDate__c=System.Today());

    

insert mg; 

     

 

//  Define connection id 

      Id networkId = ConnectionHelper.getConnectionId(

'Hartford Life GBD');

 

     

Set<Id> LASet = newSet<Id>();

     

Set<Id> AccSet = newSet<Id>();

      List<

Location_Assignment__c> Assignment = new List<Location_Assignment__c>();

     

// only share records created in this org, do not add accounts received from another org.

 

     

for (Location_Assignment__c newLocAssgn : location )

     {

      

if  (newLocAssgn.Id != null  )

         {

            LASet.add(newLocAssgn.Id);

            AccSet.add(newLocAssgn.account__c);

            Assignment.add(newLocAssgn);

          }    

        }

           

if (LASet.size() > 0)

            {

            List<

PartnerNetworkRecordConnection> LAConnections =  new  List<PartnerNetworkRecordConnection>();

            

for (Location_Assignment__c newLA : Assignment)

             {

               

if (LASet.contains(newLA.Id))

                {                

                    System.debug(

'AccountId'+newLA.account__c);

                   

PartnerNetworkRecordConnection newConnection =

                     

newPartnerNetworkRecordConnection(

                          ConnectionId = networkId,

                          LocalRecordId = newLA.Id,

                          SendClosedTasks =

false,

                          SendOpenTasks =

false,

                          SendEmails =

false,

                          ParentRecordId = newLA.account__c);

//newLA.account__c);

                          LAConnections.add(newConnection);

                } 

            }

           

if (LAConnections.size() > 0 )

             {

                   database.

insert(LAConnections);

             }

        }

  }   

}

Hi All I am trying run the scheduler every minuter and it does not seem to run and and not able to see the instance in the logs . Is there any we need to start the scheduler /or any other setting needs to be done . How will this scheduler be called ? Help really appreciated ., below is the code Tom global class Scheduled_Account_Migrate { global void execute(SchedulableContext SC) { Migrate_Account_Class_Batch Acc = new Migrate_Account_Class_Batch(); // Acc.setPCAccount(); String sch = '0 * * * * * *'; system.schedule('Merge Job', sch, Acc); } }
Hi All, Need one help below I am trying to query the Lastupdated Field and then store it in a variable and then use it in another query to fetch record from another object , below is the query used Datetime Dt = [SELECT LastModifiedDate FROM MigrationDate__c order by LastModifiedDate desc Limit 1].LastModifiedDate; The above query returns something like 2011-12-20 00:33:56 but when I use this in another query it does not work and I guess it expects the date values as 2011-12-20T00:33:56.000Z . Do you know how can I use it in the query or is there any function ? pls let me know Regards Tom

Hi guys ,

 

I am pretty new to salesforce.com and need to carry out a lotus Notes integration . Does any one have the steps / configurations to be carried out ?

 

I see in saleforce.com we have a section where we can specify the syn direction for outlook and not for lotus notes , does this mean we need to do it on the lotus client  these setting ? and how do we define it for all the users in the organization ?

 

Regards

Tom

We have a migration and below is the class  causing issue because of code coverage  . I have attached the test class to.

Help really  appreciated as its very urgent  

 

 global class Migrate_Account_Class_Batch implements Schedulable


  global void execute(SchedulableContext sc)
  { 
     // query to get the lastupdate date from the Custom Settings - MigrationDate
     
     MigrationDate__c MigDt =[SELECT Id,LastUpdateDate__c FROM MigrationDate__c where Name like 'Account%' order by LastUpdateDate__c desc Limit 1];
     
     if(MigDt <> null)
     {
         DateTime Dt = MigDt.LastUpdateDate__c;
         List<Accountaccounts = [Select Id ,EMC_Match__cDUNS_Match__c from Account where LastModifiedDate > :Dt AND (EMC_Match__c = true OR DUNS_Match__c = true)];
    
         //inset a new entry in the Custom Setting - MigrationDate
         MigrationDate__c mg = new MigrationDate__c(Name='Account'+ System.now(),LastUpdateDate__c=System.Today());
         insert mg;  
        
        // Define connection id 
        Id networkId = ConnectionHelper.getConnectionId('Hartford Life GBD'); 
        
        //  System.debug('After networkId');
         
        Set<IdlocalAccountSet = new Set<Id>(); 
        List<AccountlocalAccounts = new List<Account>();
        
        // only share records created in this orgdo not add accounts received from another org
        for (Account newAccounts : accounts )
         {
          System.Debug('EMC: ' + newAccounts.EMC_Match__c + ', Duns:' + newAccounts.DUNS_Match__c ); 
           if  (newAccounts.Id != null && (newAccounts.EMC_Match__c == true || newAccounts.DUNS_Match__c == true )) 
             
            { 
                localAccountSet.add(newAccounts.Id);
                //  System.Debug('Size: '+localAccountSet.size()+', Id:' + newAccounts.Id); 
                localAccounts.add(newAccounts); 
              }     
            }
                if (localAccountSet.size() > 0)
                { 
                //    System.debug('Before Partner Network');   
                List<PartnerNetworkRecordConnectionaccountConnections =  new  List<PartnerNetworkRecordConnection>(); 
                
                for (Account newAccount : localAccounts) { 
                  if (localAccountSet.contains(newAccount.Id)) 
                  { 
                       PartnerNetworkRecordConnection newConnection = 
                          new PartnerNetworkRecordConnection
                              ConnectionId = networkId
                              LocalRecordId = newAccount.Id
                              SendClosedTasks = false
                              SendOpenTasks = false
                              SendEmails = false,
                              RelatedRecords = 'Location_Assignment__c'); 
                              accountConnections.add(newConnection); 
                             //  System.Debug('Network Id: '+networkId+', Account Id:' + newAccount.Id+', Related:' + newConnection.RelatedRecords); 
                    } 
                } 
                if (accountConnections.size() > 0 ) 
                { 
                       database.insert(accountConnections); 
                       System.debug('After Database commit');
                     
                      //    Migrate_LocAssign_Class_Batch LocAssign = new Migrate_LocAssign_Class_Batch(); 
                      //    LocAssign.setPCLocAssign();
                }
        } 
        
    }  
 }
}

 

 

 

Hi

Is there a way to find out the user who last ran the report ?  The Administrative Reports does not have this detail

 

Tom

Hi ,

 

Is there an easy way to pull the details of which all users have access to the reports?

 

Tom

Hi Need help to get the test class for the below controller .

 

Tom

 

public without sharing class RelAccExtn
{

    private list<Account> relacct;
    private Account acc;
    public boolean isCorrectRecordType
    {
        get{
             return new set<Id>{'012V00000000AQHIA2','01230000000npXrAAI'}.contains(acc.RecordTypeId);
           }
    }
    private list<Account> mRelatedAccounts;
    public list<Account> relatedAccounts{
        get {
            if (mRelatedAccounts==null) {
                mRelatedAccounts = new list<Account>();
                mRelatedAccounts.addAll([select AARP_Authorized_Agency__c,Account_Id__c,Account_No__c,
                Account__c,Agency_Business_Type__c,Agency_ID__c,Agency_Interest_Level__c,
                Agency_Loss_Notification__c,Agency_Model__c,Agency_Status__c,Agency__c,AIM__c,AnnualRevenue,
                Auto__c,A_Separate_Managed_Unit__c,BillingCity,BillingCountry,BillingPostalCode,BillingState,
                Marine_Region_Center__c,Marine_Underwriter_User__c,MARINE_UNDERWRITER__c,MasterRecordId,
                MM_Tech_Region_Center__c,MM_Tech_Underwriter_User__c,MM_TECH_UNDERWRITER__c,Monthly_Auto_Qt__c,
                Name,Nathometer__c,Needs_Batch_Processing__c,New_Accts_Under_25K__c,New_PL_WP__c,
                New_Sc_Count_25k__c,New_Sc_Count_75k__c,New_SC_WP_del__c,New__c,Non_Std__c,No_PL_Staff_Area__c,
                No__c,NumberOfEmployees,Number_of_Employees_del__c,Number_of_Producers__c,
              FROM Account where  ((EMC__c = :acc.EMC__c AND EMC__c != null) OR (DUNS_Nbr_Hdqtrs__c =:acc.DUNS_Nbr_Hdqtrs__c AND            DUNS_Nbr_Hdqtrs__c != null))
                  and Id != :acc.Id and Primary_Org__c != :acc.Primary_Org__c and RecordTypeId != :acc.RecordTypeId ]);
            }
            return mRelatedAccounts;
        }
    }
   
   public RelatedAccountExtension(ApexPages.StandardController std){
        std.addFields(new List<String>{'EMC__c','Type','DUNS_Nbr_Hdqtrs__c','Primary_Org__c','RecordTypeId'});
        this.acc = (Account)std.getRecord();
    }
}

I am trying to write a test class but i am  getting only 0% coverage , need help to get this fixed .Help appreciated.

 

 

 

global

class Migrate_LocAssign_Class_Batch implements Schedulable

 

{

 

 

globalvoid execute(SchedulableContext sc)

 

  {

 

     

MigrationDate__c MigDt =[SELECT Id,LastUpdateDate__c fromMigrationDate__cwhereNamelike'LocAssign%'orderby LastUpdateDate__c desc Limit 1];

      DateTime Dt = MigDt.LastUpdateDate__c;

      List<

Location_Assignment__c> location = [Select Id ,Account__c,Org_Unit__cfromLocation_Assignment__cwhere LastModifiedDate > :Dt];

     

      

//inset a new entry in the Custom Setting - MigrationDate

    

MigrationDate__c mg = newMigrationDate__c(Name='LocAssign'+ System.now(),LastUpdateDate__c=System.Today());

    

insert mg; 

     

 

//  Define connection id 

      Id networkId = ConnectionHelper.getConnectionId(

'Hartford Life GBD');

 

     

Set<Id> LASet = newSet<Id>();

     

Set<Id> AccSet = newSet<Id>();

      List<

Location_Assignment__c> Assignment = new List<Location_Assignment__c>();

     

// only share records created in this org, do not add accounts received from another org.

 

     

for (Location_Assignment__c newLocAssgn : location )

     {

      

if  (newLocAssgn.Id != null  )

         {

            LASet.add(newLocAssgn.Id);

            AccSet.add(newLocAssgn.account__c);

            Assignment.add(newLocAssgn);

          }    

        }

           

if (LASet.size() > 0)

            {

            List<

PartnerNetworkRecordConnection> LAConnections =  new  List<PartnerNetworkRecordConnection>();

            

for (Location_Assignment__c newLA : Assignment)

             {

               

if (LASet.contains(newLA.Id))

                {                

                    System.debug(

'AccountId'+newLA.account__c);

                   

PartnerNetworkRecordConnection newConnection =

                     

newPartnerNetworkRecordConnection(

                          ConnectionId = networkId,

                          LocalRecordId = newLA.Id,

                          SendClosedTasks =

false,

                          SendOpenTasks =

false,

                          SendEmails =

false,

                          ParentRecordId = newLA.account__c);

//newLA.account__c);

                          LAConnections.add(newConnection);

                } 

            }

           

if (LAConnections.size() > 0 )

             {

                   database.

insert(LAConnections);

             }

        }

  }   

}

Hi All I am trying run the scheduler every minuter and it does not seem to run and and not able to see the instance in the logs . Is there any we need to start the scheduler /or any other setting needs to be done . How will this scheduler be called ? Help really appreciated ., below is the code Tom global class Scheduled_Account_Migrate { global void execute(SchedulableContext SC) { Migrate_Account_Class_Batch Acc = new Migrate_Account_Class_Batch(); // Acc.setPCAccount(); String sch = '0 * * * * * *'; system.schedule('Merge Job', sch, Acc); } }
Hi All, Need one help below I am trying to query the Lastupdated Field and then store it in a variable and then use it in another query to fetch record from another object , below is the query used Datetime Dt = [SELECT LastModifiedDate FROM MigrationDate__c order by LastModifiedDate desc Limit 1].LastModifiedDate; The above query returns something like 2011-12-20 00:33:56 but when I use this in another query it does not work and I guess it expects the date values as 2011-12-20T00:33:56.000Z . Do you know how can I use it in the query or is there any function ? pls let me know Regards Tom