• Beat123
  • NEWBIE
  • 10 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hello i am Looking for Salesforce training with APEX , Visual Force, and advanced Topics. APart from this i need some support on Salesforce. please let me know if any one Willing to Support and traning. 

Thanks for your Help.

Beat. 
I am getting below error while running testing .. recently i have updated Custom settings with additinal values and started getting the below error. please help if any one have idea.

Error Message System.LimitException: Too many SOQL queries: 101
Stack Trace Class.leadTriggerHandler.assignOwner: line 86, column 1
Class.leadTriggerHandler.onBeforeInsert: line 36, column 1
Trigger.LeadsTrigger: line 4, column 1

here is test class.
@isTest(SeeAllData=true)
private class LeadTriggerHandlerTest {
	
    public static Map<String,User> testUsersMap;

    static testMethod void leadOwnerAssignmentTest() {
        Lead testLead = new Lead();
        setupTestData();
        test.startTest();
	        // Test null or blank zip code - owner should be default lead owner KCI US User
	          testLead = createLead('ABThera','Acute','');
	          system.assertEquals(SystemIdUtility.KCIUSUserId, [select OwnerId from Lead where Id=:testLead.Id].OwnerId);
	          
        	// loop through all combinations as configured in Lead Assignment custom setting and create leads with the sample values
        	for(Lead_Assignment_Settings__c las : Lead_Assignment_Settings__c.getAll().values()){
	        	testLead = createLead(String.ValueOf(las.Product__c),String.ValueOf(las.Facility_Type__c),'63000');
	        	if(Limits.getQueries() < Limits.getLimitQueries()-20){
	        		if(testUsersMap.get(String.ValueOf(las.JCA__c)) != null){	
	        			system.assertEquals(testUsersMap.get(String.ValueOf(las.JCA__c)).Id, 
	        						[select OwnerId from Lead where Id=:testLead.Id].OwnerId);
	        		}
	        	}
        	}
        	// update Lead and test Owner assignment.
        	testLead.Products__c = 'Ulta';
        	testLead.Facility_Type__c = 'Acute';
        	update testLead;
        	
        	// Test multiple product
        	testLead = createLead('Specialty Dressing;GRAFTJACKET','Acute','63000');
        	
        	// Test non matching zipcode - then Lead Owner assigned should be KCI US User
        	testLead = createLead('ABThera','Acute','99999');
        	system.assertEquals(SystemIdUtility.KCIUSUserId, [select OwnerId from Lead where Id=:testLead.Id].OwnerId);
        	
        test.stopTest();
    }
    
    private static Lead createLead(String product, String facilityType, String zipCode){
    
    	Lead newLead = new Lead();
    	newLead.FirstName = 'FirstName';
    	newLead.LastName = 'LastName';
    	newLead.Email = 'test@kci1.com';
    	newLead.Products__c = product;
    	newLead.Facility_Type__c = facilityType;
    	newLead.Zip_Postal_Code__c = zipCode;
    	
    	insert newLead;
    	
    	return newLead;
    
    }
    
    private static void setupTestData(){
		//get test users
		testUsersMap = new Map<String,User>();
		list<User> testTMVUsers=[Select Id,JCA__C, Employee_Id__c from User where IsActive=true and Employee_Id__c!=null and JCA__C='TMV' and Id !=:Userinfo.getUserId() limit 1];
		if(testTMVUsers!= null && testTMVUsers.size()==1){
			testUsersMap.put('TMV',testTMVUsers[0]);
		}		
		list<User> testTSVUsers=[Select Id,JCA__C, Employee_Id__c from User where IsActive=true and Employee_Id__c!=null and JCA__C='TSV' and Id !=:Userinfo.getUserId() limit 1];
		if(testTSVUsers!= null && testTSVUsers.size()==1){
			testUsersMap.put('TSV',testTSVUsers[0]);
		}
		list<User> testSSMUsers=[Select Id,JCA__C, Employee_Id__c from User where IsActive=true and Employee_Id__c!=null and JCA__C='SSM' and Id !=:Userinfo.getUserId() limit 1];
		if(testSSMUsers!= null && testSSMUsers.size()==1){
			testUsersMap.put('SSM',testSSMUsers[0]);
		}	
		
		//create Territory and Zip code for test user
		
		//create territory 
	
    	KCI_Territory__c testTerrTMV=new KCI_Territory__c(Name='terr-01', KCI_Legacy_Id__c='terr-001',Sales_Rep_Id__c=testUsersMap.get('TMV').employee_id__c, 
    	Territory_Code__c='TMV-test terr code',Territory_Start_Date__c=System.date.Today()-5, OwnerId=testUsersMap.get('TMV').Id);
    	KCI_Territory__c testTerrTSV=new KCI_Territory__c(Name='terr-02', KCI_Legacy_Id__c='terr-002',Sales_Rep_Id__c=testUsersMap.get('TSV').employee_id__c, 
    	Territory_Code__c='TSV-test terr code',Territory_Start_Date__c=System.date.Today()-5, OwnerId=testUsersMap.get('TSV').Id);
    	KCI_Territory__c testTerrSSM=new KCI_Territory__c(Name='terr-03', KCI_Legacy_Id__c='terr-003',Sales_Rep_Id__c=testUsersMap.get('SSM').employee_id__c, 
    	Territory_Code__c='SSM-test terr code',Territory_Start_Date__c=System.date.Today()-5, OwnerId=testUsersMap.get('SSM').Id);
    	insert new list<KCI_Territory__c>{testTerrTMV,testTerrTSV,testTerrSSM};
    	
    	
		//create zip codes
    	ZIP_Code__c testZipTMV=new ZIP_Code__c(Name='63000', KCI_Legacy_Id__c='zip-001',KCI_Territory__c=testTerrTMV.Id,Zip_Start_Date__c=System.date.Today()-5);
    	ZIP_Code__c testZipTSV=new ZIP_Code__c(Name='63000', KCI_Legacy_Id__c='zip-002',KCI_Territory__c=testTerrTSV.Id,Zip_Start_Date__c=System.date.Today()-5);
    	ZIP_Code__c testZipSSM=new ZIP_Code__c(Name='63000', KCI_Legacy_Id__c='zip-003',KCI_Territory__c=testTerrSSM.Id,Zip_Start_Date__c=System.date.Today()-5);
    	insert new list<ZIP_Code__c>{testZipTMV,testZipTSV,testZipSSM};
    
    }
}

 
Developers,

we have a oracle and Sf integration through SOA. we have two custom objects called orders and Customer in SF.. Orders will be updated for Every 15 minutes through SOA. also we have a lookup relation from orders to Customer. 

1Question : 

when Orders were updated if there is no customer ID ( we use customer id as forgien key )  found we are getting an error . says Foreign key external ID not found ..  how can i resolve this. 

2Question : 

if i write a trigger to update Customer id with the value i am getting also it asks first name and last name which is not in Salesforce .. so first time insert as unknown and second time upsert the values. , or is there any other way to resolve this?

really apprciate your help

Thanks
Beat.

 
Title attribute two different fontsfriends,

i am trying to Show two different fonts in title of page block Section. is it possible to show title  in two different Colors and Font Size .please help. please see attached image for reference how i want to show titel. [Title]

Thanks
BeatUser-added image
I am getting below error while running testing .. recently i have updated Custom settings with additinal values and started getting the below error. please help if any one have idea.

Error Message System.LimitException: Too many SOQL queries: 101
Stack Trace Class.leadTriggerHandler.assignOwner: line 86, column 1
Class.leadTriggerHandler.onBeforeInsert: line 36, column 1
Trigger.LeadsTrigger: line 4, column 1

here is test class.
@isTest(SeeAllData=true)
private class LeadTriggerHandlerTest {
	
    public static Map<String,User> testUsersMap;

    static testMethod void leadOwnerAssignmentTest() {
        Lead testLead = new Lead();
        setupTestData();
        test.startTest();
	        // Test null or blank zip code - owner should be default lead owner KCI US User
	          testLead = createLead('ABThera','Acute','');
	          system.assertEquals(SystemIdUtility.KCIUSUserId, [select OwnerId from Lead where Id=:testLead.Id].OwnerId);
	          
        	// loop through all combinations as configured in Lead Assignment custom setting and create leads with the sample values
        	for(Lead_Assignment_Settings__c las : Lead_Assignment_Settings__c.getAll().values()){
	        	testLead = createLead(String.ValueOf(las.Product__c),String.ValueOf(las.Facility_Type__c),'63000');
	        	if(Limits.getQueries() < Limits.getLimitQueries()-20){
	        		if(testUsersMap.get(String.ValueOf(las.JCA__c)) != null){	
	        			system.assertEquals(testUsersMap.get(String.ValueOf(las.JCA__c)).Id, 
	        						[select OwnerId from Lead where Id=:testLead.Id].OwnerId);
	        		}
	        	}
        	}
        	// update Lead and test Owner assignment.
        	testLead.Products__c = 'Ulta';
        	testLead.Facility_Type__c = 'Acute';
        	update testLead;
        	
        	// Test multiple product
        	testLead = createLead('Specialty Dressing;GRAFTJACKET','Acute','63000');
        	
        	// Test non matching zipcode - then Lead Owner assigned should be KCI US User
        	testLead = createLead('ABThera','Acute','99999');
        	system.assertEquals(SystemIdUtility.KCIUSUserId, [select OwnerId from Lead where Id=:testLead.Id].OwnerId);
        	
        test.stopTest();
    }
    
    private static Lead createLead(String product, String facilityType, String zipCode){
    
    	Lead newLead = new Lead();
    	newLead.FirstName = 'FirstName';
    	newLead.LastName = 'LastName';
    	newLead.Email = 'test@kci1.com';
    	newLead.Products__c = product;
    	newLead.Facility_Type__c = facilityType;
    	newLead.Zip_Postal_Code__c = zipCode;
    	
    	insert newLead;
    	
    	return newLead;
    
    }
    
    private static void setupTestData(){
		//get test users
		testUsersMap = new Map<String,User>();
		list<User> testTMVUsers=[Select Id,JCA__C, Employee_Id__c from User where IsActive=true and Employee_Id__c!=null and JCA__C='TMV' and Id !=:Userinfo.getUserId() limit 1];
		if(testTMVUsers!= null && testTMVUsers.size()==1){
			testUsersMap.put('TMV',testTMVUsers[0]);
		}		
		list<User> testTSVUsers=[Select Id,JCA__C, Employee_Id__c from User where IsActive=true and Employee_Id__c!=null and JCA__C='TSV' and Id !=:Userinfo.getUserId() limit 1];
		if(testTSVUsers!= null && testTSVUsers.size()==1){
			testUsersMap.put('TSV',testTSVUsers[0]);
		}
		list<User> testSSMUsers=[Select Id,JCA__C, Employee_Id__c from User where IsActive=true and Employee_Id__c!=null and JCA__C='SSM' and Id !=:Userinfo.getUserId() limit 1];
		if(testSSMUsers!= null && testSSMUsers.size()==1){
			testUsersMap.put('SSM',testSSMUsers[0]);
		}	
		
		//create Territory and Zip code for test user
		
		//create territory 
	
    	KCI_Territory__c testTerrTMV=new KCI_Territory__c(Name='terr-01', KCI_Legacy_Id__c='terr-001',Sales_Rep_Id__c=testUsersMap.get('TMV').employee_id__c, 
    	Territory_Code__c='TMV-test terr code',Territory_Start_Date__c=System.date.Today()-5, OwnerId=testUsersMap.get('TMV').Id);
    	KCI_Territory__c testTerrTSV=new KCI_Territory__c(Name='terr-02', KCI_Legacy_Id__c='terr-002',Sales_Rep_Id__c=testUsersMap.get('TSV').employee_id__c, 
    	Territory_Code__c='TSV-test terr code',Territory_Start_Date__c=System.date.Today()-5, OwnerId=testUsersMap.get('TSV').Id);
    	KCI_Territory__c testTerrSSM=new KCI_Territory__c(Name='terr-03', KCI_Legacy_Id__c='terr-003',Sales_Rep_Id__c=testUsersMap.get('SSM').employee_id__c, 
    	Territory_Code__c='SSM-test terr code',Territory_Start_Date__c=System.date.Today()-5, OwnerId=testUsersMap.get('SSM').Id);
    	insert new list<KCI_Territory__c>{testTerrTMV,testTerrTSV,testTerrSSM};
    	
    	
		//create zip codes
    	ZIP_Code__c testZipTMV=new ZIP_Code__c(Name='63000', KCI_Legacy_Id__c='zip-001',KCI_Territory__c=testTerrTMV.Id,Zip_Start_Date__c=System.date.Today()-5);
    	ZIP_Code__c testZipTSV=new ZIP_Code__c(Name='63000', KCI_Legacy_Id__c='zip-002',KCI_Territory__c=testTerrTSV.Id,Zip_Start_Date__c=System.date.Today()-5);
    	ZIP_Code__c testZipSSM=new ZIP_Code__c(Name='63000', KCI_Legacy_Id__c='zip-003',KCI_Territory__c=testTerrSSM.Id,Zip_Start_Date__c=System.date.Today()-5);
    	insert new list<ZIP_Code__c>{testZipTMV,testZipTSV,testZipSSM};
    
    }
}

 
Title attribute two different fontsfriends,

i am trying to Show two different fonts in title of page block Section. is it possible to show title  in two different Colors and Font Size .please help. please see attached image for reference how i want to show titel. [Title]

Thanks
BeatUser-added image

Hi All,

 

     I am new to Sales force. I have started developing Recriting app application by following instruction using Force.com_Developer.pdf. I had created location object in Recruting app. I am trying to load data into objct. In the pdf, they specified Location.csv which was available in code share for this book. I am unable to get CSV file. Can some body help on this.

 

Thanks in advance.

 

Prasuna.