• Amit Chaudhary 8
  • ALL STAR
  • 37678 Points
  • Member since 2014
  • Salesforce CRM Consultant


  • Chatter
    Feed
  • 1123
    Best Answers
  • 1
    Likes Received
  • 32
    Likes Given
  • 3
    Questions
  • 5426
    Replies
I'm having trouble verifying a step in the Customize an Org to Support a New Business Unit. (https://trailhead.salesforce.com/projects/customize-an-org-to-support-a-new-business-unit/steps/manage-user-access) I've reviewed the setup a handful of times and even created a new playground and still receiving same error message:
Challenge Not yet complete... here's what's wrong: 
Could not find a user name 'Fumiko Suzuki' with the configuration specified in the project. Please check the step again.
Fumiko Susuki User Setup
Hi,

I keep getting the following compile error:

Class LeadProcessor must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)

FYI, here is my class code:

global class LeadProcessor implements Database.Batchable<Sobject>
    {    

    global Database.QueryLocator start(Database.BatchableContext bc) 
    {
        return Database.getQueryLocator([SELECT LeadSource FROM Lead]);
    }

    global void execute(Database.BatchableContext bc, List<Leads> scope){
        // process each batch of records
        for (Leads l: scope) {
             l.LeadSource = 'Dreamforce';
             recordsProcessed = recordsProcessed + 1;
            }
        update scope;
    }    

    global void finish(Database.BatchableContext bc){}    
}

Please assist. Thanks

 
Hello,
I have received great help with a trigger that displays a warning message when the "public" checkbox is not checked on the creation of a new task with a specific record type (contact object). Upon trying to deploy this, I ran in to the "No code coverage" message, and subsquently learned that a test class mus be written and the trigger must be tested before a deployment is possible. 

I am not a programmer, really not sure how I would tackle this. I am hopeful that someone here can help me with a test class for this trigger? I would really apprecaite it! Trigger follows:


trigger PublicFORBRYANTHC on Task (after insert,after Update) {
    Set<Id> ids=new Set<Id>();
    Set<Id> Conids=new Set<Id>();

    for(Task t:trigger.new){

    ids.add(t.id);
        if(t.WhoId != null && (((String)t.WhoId).substring(0,3) == '003') ) {
        conIds.add(t.WhoId);
        }
    }
    List<Contact> con=[Select id from contact where id in:conIds and RecordTypeId in (SELECT Id FROM RecordType WHERE Name = 'Bryant HC')];

    for(Task t:trigger.new){

        if(t.IsVisibleInSelfService<> true && con.size()>0 ) {

                    t.AddError('Public Checkbox must be checked!');

        }

    }

}
 
Hi,

 Please help to change below trigger this is cauing system.limit.exception not sure where the issue is but still I am getting this error please suggest me.
 
Trigger convertToUSD on Opportunity (before update){
     
  Try 
   {
       List<String> oppiso = new List<String>();  
       List<date> cdate = new List<date>();
      
        List<DatedConversionRate> DatedConversion = [SELECT isocode,startdate,ConversionRate FROM DatedConversionRate] ;
   
        Opportunity conopp = [select  CurrencyIsoCode,amount,closedate  from opportunity where id = :trigger.newmap.keyset() ];  
   
        for(Opportunity o : trigger.new) 
        {
         oppiso.add(o.CurrencyIsoCode);
         cdate.add(o.closedate);
        }
    
        Double cts = [SELECT ConversionRate FROM DatedConversionRate 
                 where isocode IN :oppiso and 
                       startdate <= :cdate 
                 order by startdate desc limit 1].conversionRate;
                 
                  
       for(Opportunity ops : trigger.new) 
       {
        ops.CURRENCY_RATE__c = cts;
       }
    }
    
     catch (System.LimitException e) {
        system.debug('Exception going more than 50k+');
      }
    catch (Exception e)
    {
        system.debug(e);
        for(Opportunity ops : trigger.new) 
        {
        ops.CURRENCY_RATE__c = null;
        }
    }  
}

Thanks
Sudhir
 
Here is the code for the Batch class: 
global class SmsCounterBatch implements Database.Batchable<sObject> {

	global Database.QueryLocator start(Database.BatchableContext BC) {
		return Database.getQueryLocator([
			SELECT 
				Id, Total_SMS_Delivered__c, Total_SMS_Failed__c, Total_SMS_Sent__c, 
				(
					SELECT Id, SMS_Delivery_Status__c 
					FROM ActivityHistories 
					WHERE (ActivityType = 'SMS') AND (Status = 'Completed')
				) 
			FROM Campaign 
			WHERE (IsActive = TRUE) AND (EndDate >= TODAY) 
			ORDER BY LastModifiedDate DESC
		]);
	}

   	global void execute(Database.BatchableContext BC, List<Campaign> scope) {
   		List<Campaign> campaignToUpdate = new List<Campaign>();

		for(Campaign campaign : scope) {
			if(!campaign.ActivityHistories.isEmpty()) {
				campaign.Total_SMS_Delivered__c = 0;
				campaign.Total_SMS_Failed__c = 0;
				campaign.Total_SMS_Sent__c = 0;

				for(ActivityHistory record : campaign.ActivityHistories) {
					if(record.SMS_Delivery_Status__c == 'Delivered') campaign.Total_SMS_Delivered__c++;
					else if(record.SMS_Delivery_Status__c == 'OK') campaign.Total_SMS_Sent__c++;
					else campaign.Total_SMS_Failed__c++;
				}

				campaignToUpdate.add(campaign);
			}
		}

		if(!campaignToUpdate.isEmpty()) update campaignToUpdate;
	}
	
	global void finish(Database.BatchableContext BC) {  }
}

And currently, I only figured out this testing class:
@isTest(SeeAllData=true) 
public class SmsCounterBatchTest {

    @IsTest public static void couterBatchTestMethod() {
    	
    	Campaign cam1 = new Campaign ();
        cam1.Name = 'Test Campaign 1';
        cam1.IsActive = True;
        cam1.Total_SMS_Delivered__c = 0;
        cam1.Total_SMS_Sent__c = 0;
        cam1.Total_SMS_Failed__c = 0;
        
    	Insert cam1;
    	
    	Campaign cam2 = new Campaign();
        cam2.Name = 'Test Campaign 2';
        cam2.IsActive = True;
        cam2.Total_SMS_Delivered__c = 0;
        cam2.Total_SMS_Sent__c = 0;
        cam2.Total_SMS_Failed__c = 0;
        
    	Insert cam2;
        Contact c = new Contact();
        c.LastName = 'Test Account';

        insert c;
        
        SMS__c sms = new SMS__C();
        sms.Campaign__c = cam1.Id;
        sms.Delivery_Status__c = 'Delivered';
        sms.Message__c = 'Test Message';
        sms.Recipient__c = c.Id;
        sms.Transaction_ID__c = '1b9f8ac8eb75494e80f1474aeb61d93d';
        
        insert sms;
        List<Campaign> campaignList = [SELECT Id, Total_SMS_Delivered__c, Total_SMS_Failed__c, Total_SMS_Sent__c, 
				(
					SELECT Id, SMS_Delivery_Status__c 
					FROM ActivityHistories 
					WHERE (ActivityType = 'SMS') AND (Status = 'Completed')
				) 
			FROM Campaign 
			WHERE (IsActive = TRUE)];
        if(!campaignList.isEmpty()) {

        cam1.Total_SMS_Delivered__c = 0;
        cam1.Total_SMS_Sent__c = 0;
        cam1.Total_SMS_Failed__c = 0;
        }
        update cam1;
        

        Test.StartTest();

        SmsCounterBatch counterBatch = new SmsCounterBatch();
     	
     	Database.executeBatch(counterBatch);
	    
	    Test.StopTest();   
        System.AssertEquals(database.countquery('SELECT COUNT()'+' FROM SMS__c'), 21);
    }
}

And here the uncovered part of the Batch class:

User-added image

I will appreciate any kind of help.
Thank you
I am getting a Attempting to dereference a null object in my test. I am new to Test writing and have not ficured out how to pass the test account into the test controller. 
 
public class CustomerInfoSheet {
    public String PrintOut { get; set; }
    public String LookupID;
    public String LookupType;
    
    
     public CustomerInfoSheet() {
        LookupID = ApexPages.currentPage().getParameters().get('id');
        LookupType = ApexPages.currentPage().getParameters().get('l');
        List<Account> a;
        
        PrintOut = '';      
        
                  
        if (LookupType == 'a' ){
            a = [select Name,  Industry, Type from Account where Id = :LookupID];
        } 
        if (LookupType == 'z' ) {
            a = [select Name, Industry, Type from Account where Zone__c = :LookupID];
        }
 
       //Industry
         {myPicklist.clear();
             Schema.DescribeFieldResult field = Account.Industry.getDescribe();
            for (Schema.PicklistEntry f : field.getPicklistValues()){
             myPicklist.add(f.getLabel());}
             }
         string test104 = '';
         for (String str : myPicklist)
         {test104 += str + ' -/- ';}
         test104 = test104.removeEnd(' -/- ');
         String Industrylist = String.valueOf('No Value Selected - Please Select one now: '+ test104);
         
         
               
        String CustomerName = '';
        
        String Industry = '';
      
        if (!a.isEmpty()){
            for (Account CustomerInfo : a) {
                
                CustomerName = CustomerInfo.Name;
                              
                 if (!(CustomerInfo.Industry == null)) { Industry = CustomerInfo.Industry; } else { Industry = Industrylist;}
                              
                PrintOut += '<div style="page-break-after:always;">';
                PrintOut += '<strong>Company: </strong>';
                PrintOut += CustomerName;
                 PrintOut += '<br/>';
                PrintOut += '<br/>';
                PrintOut += '<strong>Industry: </strong>';
                PrintOut += Industry;
              }
        }
    }    
}
​@IsTest
    public class CustomerInfoSheetTest {
        
     static testMethod void testCustomerInfoSheet() {

                          Account acct = (Account)Account.sObjectType.newSObject(null, true);
                         acct.Name='TestAccount';                 
                         acct.Industry = 'AG';
                          insert acct;
                         system.debug('account inserted '+acct.Id);
                     ApexPages.currentPage().getParameters().put('id', acct.Id);
                 system.debug('Account Fields '+acct);

                  CustomerInfoSheet ac = new CustomerInfoSheet(); // attempting to dereference a null object here. 
    system.debug('CustomerInfoSheet'+ac);
 }    
}

 
Please could someone help me
Error MessageSystem.QueryException: unexpected token: '('
Stack TraceClass.batchAccountUpdate.start: line 4, column 1

I get this error message when I am trying to run the test class for this batch
 
global class batchAccountUpdate implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT id, Name FROM Opportunity WHERE Createddate =:system.today() AND Status <> \'closed\' AND Has_IBM_Product__c = False AND Id IN : (SELECT OpportunityId FROM OpportunityLineItem WHERE pricebookentry.product2.family =\'XYZ\') limit 10';
        
        return Database.getQueryLocator(query);
    }
   
    global void execute(Database.BatchableContext BC, List<Opportunity> scope) {
         for(Opportunity Opp : scope)
         {
             Opp.Has_ABC_Product__c = True;            
         }
         update scope;
    }   
    
    global void finish(Database.BatchableContext BC) {
    }
}

 
  • October 04, 2017
  • Like
  • 0
I am trying to deploy the following trigger into production. I am getting a code coverage error of 69%. It shows it failed with two test classes. What can I do to correct. I need to unfortunately have this deployed this evening or first thing in the morning. Any help would be greatly appreciated. I am a Salesforce Administrator not a Developer so I am a beginner to say the least.

TRIGGER CODE
trigger Opportunity_Adelphic_AE_Email_Trigger on Opportunity (before insert, before update) {

    map<string, string> DM = new map<string, string>();
    Set<String> Person = new Set<String>();
    For(Opportunity opp : trigger.new)
    {
        if(opp.Adelphic_AE__c!=null)
        Person.add(opp.Adelphic_AE__c);
    } 
    
    List<Holding_Object__c> HoldingLst = new List<Holding_Object__c>();
    if(Person!=null && Person.size()>0)
    {
       HoldingLst=[select Persons_Name__c, Email_Address__c from Holding_Object__c where Persons_Name__c in: Person];
    }
    
    if(HoldingLst!=null && HoldingLst.size()>0)
    {
        for(Holding_Object__c hd : HoldingLst)
        {
            DM.put(hd.Persons_Name__c, hd.Email_Address__c);
        }
    }
    
    for(opportunity opp : trigger.new)
    {
        if(DM.Containskey(opp.Adelphic_AE__c) && DM.get(opp.Adelphic_AE__c)!=null)
        opp.Adelphic_AE_Email__c = DM.get(opp.Adelphic_AE__c);
    }
    
}


MassLeadConverterControllerTest Test Class Error:
Error Message: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: [BillingCountry]

Stack Trace: Class.MassLeadConverterControllerTest.massLeadTest: line 11, column 1

test_updatecontactrolecount​ Test Class Error:
Error Message: System.Exception: Assertion Failed

Stack Trace: Class.test_updatecontactrolecount.testcreateopptywithconditionandrole: line 38, column 1
 
public class ExtentionExample1 {
    public account acc   {get;set;}
    public ExtentionExample1(apexpages.standardcontroller cont){
        string[] names=new string[]{'name','phone','industry','rating'};
            cont.addfields(names);
        acc=(account)cont.getrecord();
    }
    public pagereference save(){
        string str=acc.name;        
        integer count=[select count() from account where name =: str];
        if(count>0){
            acc=[select name,phone,industry,rating from account where name =: str];
            return null;
        }
        else{
            insert acc;
        	pagereference pag=new pagereference('/'+acc.Id);
        	return pag;
        }
    }
}
plz write the test class for the above code
 
  • September 24, 2017
  • Like
  • 0
I am at the part where I am authorizing the DevHub using the web login flow:
sfdx force:auth:web:login -d -a DevHub.
It has been a while and I do not see any activity on the command prompt. How long does it take to authorize the DevHub?
Hi all - I am totally stumped. I have been trying to figure out how to create  a test class for the following class and I just can't get it to do it's thing. Any help?
 
trigger AssociatedSessions on Group__c (after insert) {

	List<Session__c> session = new List<Session__c>();
    
    for (Group__c newGroup: Trigger.New) {
            Date sd1 = newGroup.Start_Date__c;
            Date ed1 = newGroup.End_Date__c;
            
        if (newGroup.Frequency__c == 'weekly') {            

             integer numberOfWeeks = sd1.daysBetween(ed1) / 7 ;
         
            	for(integer i = 0; i < numberOfWeeks ; i++){
                    
  //If MOnday is included                  
                    IF(newGroup.Days_of_the_Week__c.contains('Monday') ){
                      IF(newGroup.Begins_on_a__c <= 1) {  
                     	 Date firstMonday = newGroup.Start_Date__c.toStartOfWeek() + 1;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstMonday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 1) {  
                     	 Date firstMonday = newGroup.Start_Date__c.toStartOfWeek() + 8;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstMonday + i * 7)
                 			 );
                       	 }
                    	
                  }
 //If Tuesday is included                 
                  IF(newGroup.Days_of_the_Week__c.contains('Tuesday') ){
                      IF(newGroup.Begins_on_a__c <= 2) {  
                     	 Date firstTuesday = newGroup.Start_Date__c.toStartOfWeek() + 2;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstTuesday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 2) {  
                     	 Date firstTuesday = newGroup.Start_Date__c.toStartOfWeek() + 9;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstTuesday + i * 7)
                 			 );
                       	 }
                    	
                  }
 //If Wednesday is included                   
                    IF(newGroup.Days_of_the_Week__c.contains('Wednesday') ){
                      IF(newGroup.Begins_on_a__c <= 3) {  
                     	 Date firstWednesday = newGroup.Start_Date__c.toStartOfWeek() + 3;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstWednesday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 3) {  
                     	 Date firstWednesday = newGroup.Start_Date__c.toStartOfWeek() + 10;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstWednesday + i * 7)
                 			 );
                       	 }
                    	
                  }
 //if Thursday is included
                    IF(newGroup.Days_of_the_Week__c.contains('Thursday') ){
                      IF(newGroup.Begins_on_a__c <= 4) {  
                     	 Date firstThursday = newGroup.Start_Date__c.toStartOfWeek() + 4;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstThursday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 4) {  
                     	 Date firstThursday = newGroup.Start_Date__c.toStartOfWeek() + 11;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstThursday + i * 7)
                 			 );
                       	 }
                    	
                  }
                    
//If Friday is included                   
                IF(newGroup.Days_of_the_Week__c.contains('Friday') ){
                      IF(newGroup.Begins_on_a__c <= 5) {  
                     	 Date firstFriday = newGroup.Start_Date__c.toStartOfWeek() + 5;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstFriday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 5) {  
                     	 Date firstFriday = newGroup.Start_Date__c.toStartOfWeek() + 12;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstFriday + i * 7)
                 			 );
                       	 }
                    	
                 }
//If Saturday is included                   
                IF(newGroup.Days_of_the_Week__c.contains('Saturday') ){
                      IF(newGroup.Begins_on_a__c <= 6) {  
                     	 Date firstSaturday = newGroup.Start_Date__c.toStartOfWeek() + 6;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSaturday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 6) {  
                     	 Date firstSaturday = newGroup.Start_Date__c.toStartOfWeek() + 12;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSaturday + i * 7)
                 			 );
                       	 }
                    	
                 }
 //If Sunday is included                   
                IF(newGroup.Days_of_the_Week__c.contains('Sunday') ){
                      IF(newGroup.Begins_on_a__c <= 0) {  
                     	 Date firstSunday = newGroup.Start_Date__c.toStartOfWeek() + 5;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSunday + i * 7)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 0) {  
                     	 Date firstSunday = newGroup.Start_Date__c.toStartOfWeek() + 12;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSunday + i * 7)
                 			 );
                       	 }
                    	
                 }
                   
             }
            	
         }
        if (newGroup.Frequency__c == 'daily') {
            integer numberOfDays = sd1.daysBetween(ed1);
            
            for(integer i = 0; i < numberOfDays ; i++){
              	  session.add (new Session__c(
                  Term__c = newGroup.Id,
                  Date__c = sd1 + i)
                  );
             }
        }
        if (newGroup.Frequency__c == 'biweekly') { 
            integer numberOfWeeks = sd1.daysBetween(ed1) / 14 ;
         
            	for(integer i = 0; i < numberOfWeeks ; i++){
                    
  //If MOnday is included                  
                    IF(newGroup.Days_of_the_Week__c.contains('Monday') ){
                      IF(newGroup.Begins_on_a__c <= 1) {  
                     	 Date firstMonday = newGroup.Start_Date__c.toStartOfWeek() + 1;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstMonday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 1) {  
                     	 Date firstMonday = newGroup.Start_Date__c.toStartOfWeek() + 8;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstMonday + i * 14)
                 			 );
                       	 }
                    	
                  }
 //If Tuesday is included                 
                  IF(newGroup.Days_of_the_Week__c.contains('Tuesday') ){
                      IF(newGroup.Begins_on_a__c <= 2) {  
                     	 Date firstTuesday = newGroup.Start_Date__c.toStartOfWeek() + 2;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstTuesday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 2) {  
                     	 Date firstTuesday = newGroup.Start_Date__c.toStartOfWeek() + 9;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstTuesday + i * 14)
                 			 );
                       	 }
                    	
                  }
 //If Wednesday is included                   
                    IF(newGroup.Days_of_the_Week__c.contains('Wednesday') ){
                      IF(newGroup.Begins_on_a__c <= 3) {  
                     	 Date firstWednesday = newGroup.Start_Date__c.toStartOfWeek() + 3;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstWednesday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 3) {  
                     	 Date firstWednesday = newGroup.Start_Date__c.toStartOfWeek() + 10;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstWednesday + i * 14)
                 			 );
                       	 }
                    	
                  }
 //if Thursday is included
                    IF(newGroup.Days_of_the_Week__c.contains('Thursday') ){
                      IF(newGroup.Begins_on_a__c <= 4) {  
                     	 Date firstThursday = newGroup.Start_Date__c.toStartOfWeek() + 4;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstThursday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 4) {  
                     	 Date firstThursday = newGroup.Start_Date__c.toStartOfWeek() + 11;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstThursday + i * 14)
                 			 );
                       	 }
                    	
                  }
                    
//If Friday is included                   
                IF(newGroup.Days_of_the_Week__c.contains('Friday') ){
                      IF(newGroup.Begins_on_a__c <= 5) {  
                     	 Date firstFriday = newGroup.Start_Date__c.toStartOfWeek() + 5;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstFriday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 5) {  
                     	 Date firstFriday = newGroup.Start_Date__c.toStartOfWeek() + 12;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstFriday + i * 14)
                 			 );
                       	 }
                    	
                 }
//If Saturday is included                   
                IF(newGroup.Days_of_the_Week__c.contains('Saturday') ){
                      IF(newGroup.Begins_on_a__c <= 6) {  
                     	 Date firstSaturday = newGroup.Start_Date__c.toStartOfWeek() + 6;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSaturday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 6) {  
                     	 Date firstSaturday = newGroup.Start_Date__c.toStartOfWeek() + 12;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSaturday + i * 14)
                 			 );
                       	 }
                    	
                 }
 //If Sunday is included                   
                IF(newGroup.Days_of_the_Week__c.contains('Sunday') ){
                      IF(newGroup.Begins_on_a__c <= 0) {  
                     	 Date firstSunday = newGroup.Start_Date__c.toStartOfWeek() + 5;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSunday + i * 14)
                 			 );
                       	 }
                      IF(newGroup.Begins_on_a__c > 0) {  
                     	 Date firstSunday = newGroup.Start_Date__c.toStartOfWeek() + 12;
              		 	 session.add (new Session__c(
                	 	 Term__c = newGroup.Id,
                	 	 Date__c = firstSunday + i * 14)
                 			 );
                       	 }
                    	
                 }
                   
             }
            	
         }
        if (newGroup.Frequency__c == 'monthly') {
            integer numberOfMonths = sd1.daysBetween(ed1) / 30;
            integer beginsOnA = newGroup.Begins_on_a__c.intValue();
            
            
            for(integer i = 0; i < numberOfMonths ; i++){
                  date startDay = newGroup.Start_Date__c + i * 30;
              	  session.add (new Session__c(
                  Term__c = newGroup.Id,
                  Date__c = startDay.toStartOfWeek() + beginsOnA
                  ));
             }
        }
        
    insert session;
 	}
}

 
Hello. I have an Apex class and Visual Force page to create an event, where the user first selects the Account and then the page will display only the Contacts associated with that Account. I need my List<SelectionOption> to show the "+ New Contact" option that appears when you create a regular event in Salesforce. Is there a way to do this?
 
public List<SelectOption> contactOptions
    {
        get
        {
            if ( contactOptions == null && dummyContact.AccountId != null )
            {
                contactOptions = new List<SelectOption>();
                contactOptions.add( new SelectOption( 'null', '--None--' ) );
                for ( Contact contact :
                    [   SELECT  Id, Name
                        FROM    Contact
                        WHERE   AccountId = :dummyContact.AccountId
                    ]
                    )
                {
                    contactOptions.add( new SelectOption( contact.Id, contact.Name ) );
                }
            }
            return contactOptions;
        }
        private set;
    }

 
I have the below triggers and test class for them, Trigger-1 has 85% coverage and Trigger-2 has 66%, can anyone please help me in improving code coverage? Highlighted lines in bold which are not covering 

Trigger-1:   

    trigger AccountName_Opp on Opportunity (before insert, before update ){
    
        Map<String, Opportunity> OppMap = new Map<String, Opportunity>();
    
        for(Opportunity opp:Trigger.new)
        {
            OppMap.put(opp.Account_Name__c, opp);
    
        }
    
        List<Account> accLst = [SELECT ID, Name FROM Account where Name in :OppMap.keySet()];
    
        for(Account acct : accLst){
            OppMap.get(acct.Name).AccountId = acct.ID;
        }
    }

Trigger-2: 

    trigger AccountName_Contact on Contact (before insert, before update ){
    
        Set<String> conaccounts = new Set<String>();
    
        for(Contact con:Trigger.new)
        {
            conaccounts.add(con.Account_Name__c);
        }
    
        List<Account> accLst = [SELECT ID, Name FROM Account where Name in :conaccounts];
        System.debug(accLst);
        for(Account acct : accLst){
            for(Contact co : Trigger.new){
                if(co.Account_Name__c == acct.Name)
                    co.accountid = acct.id;

            }        
        }
    
    }

Testclass:
 

    @istest
    public class FFCNAccountName
    {
      static testmethod void myTest()
      {
        Map<String, Opportunity> OppMap = new Map<String, Opportunity>();
        
        Account acc = new Account(Name = 'test', phone = '1234567890');
        insert acc;
        
        Opportunity opp = new Opportunity(SaleType__c = 'new', Name = 'test', AccountId = acc.Id, Amount = 50, CurrencyIsoCode = 'USD');
        insert opp;
        
        Contact con = new Contact( LastName = 'Test2', Email = 'test.user@gmail.com', AccountId = acc.Id );
        insert con;
      }
    }
Hello,

I have setup a new SalesForce environment and I have to transfer my Apex classes on it.

In order to deploy my code I use a test class with test methods.

A validation process is started when I try to deploy the changes.

This validation invokes all existing test methods and the environment throws the following exception:
System.LimitException: Apex CPU time limit exceeded

Oddly enough on the old environment there is no such exceptions

I'm sending you a method of my source code where the Apex CPU time limit exceeded is most likely to happen:
 
private List<LeadConversionContainer> checkByWebsite(Lead leadObj) {
        List<LeadConversionContainer> accountWebsites = new 
        List<LeadConversionContainer>();
        String website = leadObj.Website;
        String leadId = leadObj.Id;
        List<Account> accWebsiteList = [SELECT Website, Url__c, Status__c FROM 
        Account];
        if(website != null && !website.equals('') && accWebsiteList != null) {
            List<String> leadWebsites = extractWebsites(website);
            for (String leadUrl : leadWebsites) {
                String normWebsite = normalizeWebsite(leadUrl);
                String leadWebsite = normWebsite.trim();
                for(Account acc : accWebsiteList) {
                    String accountWebsite = acc.Url__c;
                    String accountId = acc.Id;
                    List<String> extractedAccountWebsite = 
                    extractWebsites(accountWebsite);
                    for(String accWebsite :extractedAccountWebsite) {
                        String accountSite = normalizeWebsite(accWebsite);
                        if(accountSite != null) {
                            List<String> leadSplitWebsitesList = leadWebsite.split('[,;\\s]');
                            for(String leadSplitUrls :leadSplitWebsitesList) {
                                if(accountSite.equals(leadSplitUrls)) {
                                    boolean isAccountStatusActive = isAccountActive(acc);
                                    boolean isMerchantApplication = 
                                    isMerchantApplicationsAttached(acc);
                                    if(isAccountStatusActive || isMerchantApplication) {
                                        String reasonToStopConversion = 'Lead Website coincide with 
                                        Account Website';
                                        LeadConversionContainer leadConvert = new 
                                        LeadConversionContainer(acc.Id, '', reasonToStopConversion);
                                        accountWebsites.add(leadConvert);
                                    }
                                }    
                            }
                        }
                    }
                }    
            }
        }
        return accountWebsites;
    }

Please advise how to solve the issue with my deploy and avoid such System.LimitException: Apex CPU time limit exceeded exception?
Hi all,

I'm trying to set up a test class to test my RPIRequestExtension to get it into live my live org to implement my VisualForce pages.

Could you guys please help me?

ApexClass
public class RPIRequestExtension {
    ApexPages.StandardController stdCtrl;
    public RPIRequestExtension(ApexPages.StandardController std)
    {
       stdCtrl=std;
    }

    public PageReference save()
    {
        stdCtrl.save();
        return null;
    }
}

TestClass
@isTest 
public class TestRPIRequestExtension {
    static testMethod void testMethode() {

       RPIRequestExtension(ApexPages.StandardController std)
    {
       stdCtrl=std;
    }
        
}

Thanks!
Hello all,
         i have written trigger for: Create Custom field called “Number of Locations” on the Account Object (Data Type=Number) The trigger creates the number of contacts which are equal to the number which we will enter in the Number of Locations field on the Account Object
    public static void createMultipleOpportunity(List<Account> acc)
   {
         List<Opportunity> opp= new List<Opportunity>();
         for( Account a:acc)
         {  for(Integer i=1; i<=a.Number_of_Location__c;i++)
            {Opportunity opt=new Opportunity();
            opt.name=a.name;
            opt.Type='New Customer';
            opt.CloseDate = system.today()+1;
            opt.StageName='In Progress';
            opp.add(opt); 
            }   
            
         }
          insert opp;
   }

and it works fine but how can i write this trigger with best practices 
hi..need a help in query...oh batch class
Error is : unexpected token: ')' 
We would like to move leads currently in the Working or Busy status that do not have completed tasks in the last 30 days to the ABC status.
  • Lead Status = Working, Busy
  • Last Activity Date < Today – 30

We want to scheduale a batch class daily basis...here is the code..
global class Leadinactiveflow implements Database.Batchable<SObject>

{

 global Database.Querylocator start (Database.BatchableContext BC)
  {
         
   String query = 'SELECT Id, Status, LastActivityDate ,(select id, createdDate,status from Tasks )From Lead WHERE Status in (\'Working\', \'Busy\')  AND  (Today() - LastActivityDate) > 30';
   System.debug(query);

      return Database.getQueryLocator(query);          

  }
  global void execute (Database.BatchableContext BC, List <Lead> scope)

  {

   List<Lead> listLead = new List<Lead>();

    for(Lead l : scope)
     {
      
         l.Status = 'ABC';     

      listLead.add(l);

      }

   
         if(!listLead.isEmpty()){
            update listLead;
        } 

  } 

global void finish (Database.BatchableContext BC)

{

}

}
Schedulable class is :
 
global with sharing class SchedulerForBatchApex implements Schedulable

{
    global void execute(SchedulableContext sc)        

  {
      Leadinactiveflow b = new Leadinactiveflow();
      ID BatchID = Database.executeBatch(new Leadinactiveflow(), 200);
  }

Public static void SchedulerMethod() 

    {
    string con_exp='0 0 1 * * ?';

    System.schedule('LeadinactiveflowTest', con_exp, new SchedulerForBatchApex());
                                     
    }   

}


 
  • September 01, 2017
  • Like
  • 0
Hello Everyone!

I have created a trigger and class in my sandbox that fires after insert and after update.  I am now working on creating a test class for it, and I am achieving code coverage, but as soon as I add in System.assertEquals(1, [select count() from Commissions_Chart__c]); to verify that a record has been created, it fails.  Any help is appreciated!!  Trigger, class, and test class are below!

Trigger:
trigger CommissionsTrigger on Opportunity (after update, after insert) {
    
    List<Opportunity> comToUpdate = new List<Opportunity>();
    List<Opportunity> comToInsert = new List<Opportunity>();
    List<Opportunity> comToDelete = new List<Opportunity>();
    
    For(Opportunity opp:Trigger.new){
        If(Trigger.isupdate){
            Opportunity oldOpp = Trigger.oldMap.get(opp.Id);
            If(oldOpp.OwnerId != opp.OwnerId){
                comToDelete.add(opp);
                comToInsert.add(opp);
            }
        }
        system.debug('Opps to Delete: ' + comToDelete);
        System.debug('Opps to Insert: ' + comToInsert);
    }
    
    For(Opportunity o: Trigger.new){
        If(Trigger.isinsert){
            comToInsert.add(o);
        }
        If(Trigger.isUpdate){
            comToUpdate.add(o);
        }
    }
    
   if(comToInsert.size()>0){
        CommissionsClass.CreateCommissionsObject(comToInsert);
       system.debug('comToInsert List is : ' + comToInsert);
    }
    If(comToDelete.size()>0){
        CommissionsClass.DeleteCommissionsObject(comToDelete);
        system.debug('comToDelete List is : ' + comToDelete);
    }
   if(comToUpdate.size()>0){
        CommissionsClass.UpdateCommissionsObject(comToUpdate);
       System.debug('comToUpdate List is : ' + comToUpdate);
    }
    

}



Class:
public class CommissionsClass {
    public static void CreateCommissionsObject(Opportunity[] comToInsert){
        List<Commissions_Chart__c> comInsert = new List<Commissions_Chart__c>();
        List<Commissions__c> comToAttach = [select Id, OwnerId, Commissions_Month__c FROM Commissions__c WHERE Commissions_Month__c = THIS_MONTH];
        
        For(Commissions__c cm : comToAttach){
            For(Opportunity o : comToInsert){
                If(cm.OwnerId == o.OwnerId){
                    Commissions_Chart__c c = new Commissions_Chart__c(Account_Name__c = o.AccountId, Close_Date__c = o.closeDate, 
                                                              Opportunity_MRR__c = o.Billing_Amount_Monthly_Calcualted__c,Opportunity_Name__c = o.Id,
                                                             Opportunity_Stage__c = o.StageName, User__c = o.OwnerId, Commissions__c = cm.Id, Payment_Term__c = o.Contract_Payment_Terms__c, 
                                                                      Services_Amount__c = o.Professional_Service_Amount__c);
                    If(o.Total_Renewal_Term__c != NULL){
                        c.Term__c = o.Contract_Initial_Term_Months__c + o.Total_Renewal_Term__c;
                    }else{
                        c.Term__c = o.Contract_Initial_Term_Months__c;
                    }
                    comInsert.add(c);
                }
        }
        }
        System.debug('ComInsert list: ' + comInsert);
        insert comInsert;
    }
    
    public static void DeleteCommissionsObject(Opportunity[] comToDelete){
        
       List<Commissions_Chart__c> ccToDelete = new List<Commissions_Chart__c>();
       List<Commissions_Chart__c> charts = [select Id, Opportunity_Name__c, User__c from Commissions_Chart__c where Opportunity_Name__c In : ComToDelete];
       List<Opportunity> opps = [select ID, OwnerId from Opportunity where ID in :comToDelete];
        
        For(Commissions_Chart__c ch : charts){
            for (opportunity ops : opps){
                If(ch.User__c != ops.OwnerId){
                    ccToDelete.add(ch);
                }
            }
        }
            Database.DeleteResult[] drList = Database.delete(ccToDelete, false);

        
        for(Database.DeleteResult dr : drList){
            if(dr.isSuccess()){
                System.debug('Successfully deleted Commissions Chart with ID: ' + dr.getID());
            }
            else {
                for (Database.Error err : dr.getErrors()){
                    system.debug('The following error has occurred.');
                    system.debug(err.getStatusCode() + ' : ' + err.getMessage());
                    System.debug('Commissions Chart fields that affected this error: ' + err.getFields());
                }
            }
        }


        
    }
    
        public static void UpdateCommissionsObject(Opportunity[] comToUpdate){
        List<Commissions_Chart__c> comUpdate = [SELECT Id, Account_Name__c, Close_Date__c, Opportunity_MRR__c, Opportunity_Name__c, Opportunity_Stage__c, User__c, Term__c 
                                                FROM Commissions_Chart__c WHERE Close_Date__c = THIS_YEAR];
        List<Commissions_Chart__c>updatecom = new List<Commissions_Chart__C>();
        
        for(Commissions_Chart__c cc:comUpdate){
            For(opportunity op : comToUpdate){
                If(cc.Opportunity_Name__c == op.Id){
                    cc.opportunity_stage__C = Op.StageName;
                    cc.Close_Date__c = op.CloseDate;
                    cc.Opportunity_MRR__C = op.Billing_Amount_Monthly_Calcualted__c;
                    cc.Payment_Term__c = op.Contract_Payment_Terms__c;
                    cc.Services_Amount__c = op.Professional_Service_Amount__c;
                    If(op.Total_Renewal_Term__c != NULL){
                        cc.Term__c = op.Contract_Initial_Term_Months__c + op.Total_Renewal_Term__c;
                    }else{
                        cc.Term__c = op.Contract_Initial_Term_Months__c;
                    }
                    
                    updatecom.add(cc);
                }
                system.debug(updatecom);
            }
        }
            update updatecom;

        
    }

}



Test Class:
@isTest
public class CommissionsCalculatorTest {
    static testMethod void CommissionsTriggerTest() {
    
        //fetch IDs for records
        Profile P = [select ID from Profile where Name = 'Standard User'];
        RecordType rt = [select ID from recordtype where name ='New Business'];
        
        
        //Create a user for testing
        User u = new User(FirstName = 'Testing', 
                          LastName = 'User', 
                          email = 'testing@bizible.com', 
                          monthly_quota__c = 5000,
                         username = 'testing@bizible.com',
                         Alias = 'tuser',
                         profileId = p.Id,
                         TimeZoneSidKey = 'America/Los_Angeles',
                         LocaleSidKey = 'en_US',
                         EmailEncodingKey = 'UTF-8',
                         LanguageLocaleKey = 'en_US');
        Insert u;
    
        //Create account for Opportunities
        Account a = new Account(Name = 'TestingCommissions',
                               OwnerId = u.Id,
                               ADR_Owner__C = u.Id);
        Insert a;
        
        //Create Commissions__C record for commissions Chart
        Commissions__c c = new Commissions__c(Name = u.FirstName,
                                          OwnerId = u.Id,
                                          Commissions_month__c = System.today());
        
        
        //Create Opportuntitiy for Trigger
        List<Opportunity> Opps = new List<Opportunity>();

        Opportunity o1 = new Opportunity(Name = 'TestCommissions1',
                                   stageName = 'Qualified Discovery',
                                   CloseDate = system.date.today(),
                                   Amount = 12000,
                                   AccountID = a.ID,
                                   Contract_Payment_Terms__c = 'Monthly',
                                   Contract_Initial_Term_Months__c = 12,
                                   OwnerId = u.Id,
                                   recordtypeID = rt.Id);

       

        Test.startTest();
        
        insert o1;

        Test.stopTest();
        
        System.assertEquals(1, [select count() from Opportunity]);
        System.assertEquals(1, [select count() from Commissions_Chart__c]);
    }
}
 
trigger DeleteCompletedCallbackTaskTrigger on Task (after update) {
    for (Task task: Trigger.new) {
      if(task.status == 'Completed' && task.subject == 'Callback') {
        delete Task;
    }
  }
}
Hello,

I no more see the DEV401 maintainance exam. 

Can someone guide me ?
I got to know that , Salesforce has recently introduced the Platform Developer 1 certification (DEV450) to replace the Developer (DEV401) certification. All practitioners, with the DEV401 certification, must complete the DEV450 exam during 2016 to retain a Salesforce developer certification.

Is this true as i dnt not got any email from salesforce / webassessvor that if you will not give the DEV450 exam then your DEV401 certifcate will expire ?
 
When i am posting code "" is not printing. And Some code is removing automatically. 

Any idea . It look like some issue ?
External Lookup Relationship could now be setup between external objects and Salesforce object.
External Object - They are same as custom objects but used to map to data located outside Salesforce.
External object take data from External source and External source obviously has its own DB. 
To create external object : From Setup, click Develop | External Objects.
To create external Data source : Develop | External data source
 
I got to know that , Salesforce has recently introduced the Platform Developer 1 certification (DEV450) to replace the Developer (DEV401) certification. All practitioners, with the DEV401 certification, must complete the DEV450 exam during 2016 to retain a Salesforce developer certification.

Is this true as i dnt not got any email from salesforce / webassessvor that if you will not give the DEV450 exam then your DEV401 certifcate will expire ?
 
I'm having trouble verifying a step in the Customize an Org to Support a New Business Unit. (https://trailhead.salesforce.com/projects/customize-an-org-to-support-a-new-business-unit/steps/manage-user-access) I've reviewed the setup a handful of times and even created a new playground and still receiving same error message:
Challenge Not yet complete... here's what's wrong: 
Could not find a user name 'Fumiko Suzuki' with the configuration specified in the project. Please check the step again.
Fumiko Susuki User Setup
I have created a visualforce pdf attachment to email template but I'm not sure how can I add a related list to my file.
Hi,

I keep getting the following compile error:

Class LeadProcessor must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)

FYI, here is my class code:

global class LeadProcessor implements Database.Batchable<Sobject>
    {    

    global Database.QueryLocator start(Database.BatchableContext bc) 
    {
        return Database.getQueryLocator([SELECT LeadSource FROM Lead]);
    }

    global void execute(Database.BatchableContext bc, List<Leads> scope){
        // process each batch of records
        for (Leads l: scope) {
             l.LeadSource = 'Dreamforce';
             recordsProcessed = recordsProcessed + 1;
            }
        update scope;
    }    

    global void finish(Database.BatchableContext bc){}    
}

Please assist. Thanks

 
I need help with the fllowing code:
apex:page controller="ContactsListController">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="contacts_list">
             
            <!-- Contacts List goes here -->
            <!-- Contacts List -->
<apex:pageBlockTable value="{! contacts }" var="ct">
 
    <apex:column value="{! ct.FirstName }"/>
    <apex:facet name="header">
        <apex:commandLink action="{! sortByFirstName }"
            reRender="contacts_list">First Name
        </apex:commandLink>
    </apex:facet>
    </apex:column>

    <apex:column value="{! ct.LastName }"/>
           <apex:facet name="header">
        <apex:commandLink action="{! sortByLastName }"
            reRender="contacts_list">Last Name
        </apex:commandLink>
    </apex:facet>
</apex:column>

    <apex:column value="{! ct.Title }"/>
    <apex:column value="{! ct.Email }"/>
     
     </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I wrote this code but everytime I run this code it gives me a following error.

Error: ContactListController line 15, column 7: The element type "apex:pageblocktable" must be terminated by the matching end-tag "</apex:pageblocktable>"
Error: The element type "apex:pageblocktable" must be terminated by the matching end-tag "</apex:pageblocktable>".
Hello,
I have received great help with a trigger that displays a warning message when the "public" checkbox is not checked on the creation of a new task with a specific record type (contact object). Upon trying to deploy this, I ran in to the "No code coverage" message, and subsquently learned that a test class mus be written and the trigger must be tested before a deployment is possible. 

I am not a programmer, really not sure how I would tackle this. I am hopeful that someone here can help me with a test class for this trigger? I would really apprecaite it! Trigger follows:


trigger PublicFORBRYANTHC on Task (after insert,after Update) {
    Set<Id> ids=new Set<Id>();
    Set<Id> Conids=new Set<Id>();

    for(Task t:trigger.new){

    ids.add(t.id);
        if(t.WhoId != null && (((String)t.WhoId).substring(0,3) == '003') ) {
        conIds.add(t.WhoId);
        }
    }
    List<Contact> con=[Select id from contact where id in:conIds and RecordTypeId in (SELECT Id FROM RecordType WHERE Name = 'Bryant HC')];

    for(Task t:trigger.new){

        if(t.IsVisibleInSelfService<> true && con.size()>0 ) {

                    t.AddError('Public Checkbox must be checked!');

        }

    }

}
 
Im creating this code from scratch but I'm getting and error: Illegal assignment from List<TSF_vod__c> to List<String>

public static String getMyObjAB() { 
        List <String> TSFObjetivos = new List<String> ();
        List <String> Objterr = 
        [SELECT Call_Reminder_TSF__c from TSF_vod__c where Account_vod__c = '0015000001Bbyb9AAB'];
        return MyObjAB;
    }

What can I do?
I am in trailhead and trying to complete a challenge on my developer page. I keep receiveing a Storage Limit Error message when trying to save. Any suggestions?  
hi everyone

Please support me that i have seen , how to search in  the datatable on the visualfroce page ??



Please support me


Thanks

Nagma
I am unable to build a Trailhead playground (I have tried in Chrome and Safari). In the Hands-on Challenge I keep getting two messages:
"Please hold while our robots build your Trailhead Playground. This may take a few minutes" and
"Our robots are still working..."
Like I say, I have tried two different browsers (on two machines) and I have cleared the cache on one of them but, no joy.
Any help or advice would be greatly appreciated
HI Friends,

I am using " ApexPages.Standard Controller "  in constructor , can anyone please explain how can i cover this line in test class. i am not able to create an instance for my class in the test class. please refer my following class and good advise me how can i cover this test class as well.
 
public class caseAssignment{
    //Variables
    Public Case_Associate__c str;
    public ApexPages.StandardController controller;
    Public String recType{get;set;}
    Private final Case_Associate__c caseSense;
    Public Boolean section;
    
    //Constructor | Passing Case Number Into case Associate
    public caseAssignment(ApexPages.StandardController controller) {
        this.caseSense = (Case_Associate__c)controller.getRecord();
        caseSense.Case_Number__c = ApexPages.currentPage().getParameters().get('C_A_ID');
       // caseSense.OwnerId = ApexPages.currentPage().getParameters().get('Own');
        system.debug('recType ***** |' + recType);
    }
    
    public PageReference test() {
        return null;
    }
    
    //Get Record Type & Display in VF Pages
    public List<SelectOption> GetRecordTypes() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('--None--','--None--'));
        for(RecordType sRecordType : [SELECT Id, Name FROM RecordType WHERE sObjectType = 'Case_Associate__c'])
        {
            options.add(new SelectOption(sRecordType.Id, sRecordType.Name));
        }
        system.debug('Options | ' + options);
        return options;
    }

    //Update Record Type
    Public void updateRecordType(){
        system.debug('*******  Starting ******');
        caseSense.recordTypeId = recType;
        System.debug(' ***recordTypeId *** ' + recType + '|' +  caseSense.recordTypeId);
        system.debug('recType ***** |' + recType);
    }
    
    
}

Thanks In Advance ...

Regards,
Soundar.​
 explain service life cycle in sales force ?
what are the errors you faced in apex ?
Hi ,
Sending mail in  pdf format through apex class 
Hi,

 Please help to change below trigger this is cauing system.limit.exception not sure where the issue is but still I am getting this error please suggest me.
 
Trigger convertToUSD on Opportunity (before update){
     
  Try 
   {
       List<String> oppiso = new List<String>();  
       List<date> cdate = new List<date>();
      
        List<DatedConversionRate> DatedConversion = [SELECT isocode,startdate,ConversionRate FROM DatedConversionRate] ;
   
        Opportunity conopp = [select  CurrencyIsoCode,amount,closedate  from opportunity where id = :trigger.newmap.keyset() ];  
   
        for(Opportunity o : trigger.new) 
        {
         oppiso.add(o.CurrencyIsoCode);
         cdate.add(o.closedate);
        }
    
        Double cts = [SELECT ConversionRate FROM DatedConversionRate 
                 where isocode IN :oppiso and 
                       startdate <= :cdate 
                 order by startdate desc limit 1].conversionRate;
                 
                  
       for(Opportunity ops : trigger.new) 
       {
        ops.CURRENCY_RATE__c = cts;
       }
    }
    
     catch (System.LimitException e) {
        system.debug('Exception going more than 50k+');
      }
    catch (Exception e)
    {
        system.debug(e);
        for(Opportunity ops : trigger.new) 
        {
        ops.CURRENCY_RATE__c = null;
        }
    }  
}

Thanks
Sudhir
 
Hi.
I am new to TrailHead and was wondering if anybody is using it to create non SFC training for people who have SFC accounts and so can use the TrailHead platform?

Pa
Here is the code for the Batch class: 
global class SmsCounterBatch implements Database.Batchable<sObject> {

	global Database.QueryLocator start(Database.BatchableContext BC) {
		return Database.getQueryLocator([
			SELECT 
				Id, Total_SMS_Delivered__c, Total_SMS_Failed__c, Total_SMS_Sent__c, 
				(
					SELECT Id, SMS_Delivery_Status__c 
					FROM ActivityHistories 
					WHERE (ActivityType = 'SMS') AND (Status = 'Completed')
				) 
			FROM Campaign 
			WHERE (IsActive = TRUE) AND (EndDate >= TODAY) 
			ORDER BY LastModifiedDate DESC
		]);
	}

   	global void execute(Database.BatchableContext BC, List<Campaign> scope) {
   		List<Campaign> campaignToUpdate = new List<Campaign>();

		for(Campaign campaign : scope) {
			if(!campaign.ActivityHistories.isEmpty()) {
				campaign.Total_SMS_Delivered__c = 0;
				campaign.Total_SMS_Failed__c = 0;
				campaign.Total_SMS_Sent__c = 0;

				for(ActivityHistory record : campaign.ActivityHistories) {
					if(record.SMS_Delivery_Status__c == 'Delivered') campaign.Total_SMS_Delivered__c++;
					else if(record.SMS_Delivery_Status__c == 'OK') campaign.Total_SMS_Sent__c++;
					else campaign.Total_SMS_Failed__c++;
				}

				campaignToUpdate.add(campaign);
			}
		}

		if(!campaignToUpdate.isEmpty()) update campaignToUpdate;
	}
	
	global void finish(Database.BatchableContext BC) {  }
}

And currently, I only figured out this testing class:
@isTest(SeeAllData=true) 
public class SmsCounterBatchTest {

    @IsTest public static void couterBatchTestMethod() {
    	
    	Campaign cam1 = new Campaign ();
        cam1.Name = 'Test Campaign 1';
        cam1.IsActive = True;
        cam1.Total_SMS_Delivered__c = 0;
        cam1.Total_SMS_Sent__c = 0;
        cam1.Total_SMS_Failed__c = 0;
        
    	Insert cam1;
    	
    	Campaign cam2 = new Campaign();
        cam2.Name = 'Test Campaign 2';
        cam2.IsActive = True;
        cam2.Total_SMS_Delivered__c = 0;
        cam2.Total_SMS_Sent__c = 0;
        cam2.Total_SMS_Failed__c = 0;
        
    	Insert cam2;
        Contact c = new Contact();
        c.LastName = 'Test Account';

        insert c;
        
        SMS__c sms = new SMS__C();
        sms.Campaign__c = cam1.Id;
        sms.Delivery_Status__c = 'Delivered';
        sms.Message__c = 'Test Message';
        sms.Recipient__c = c.Id;
        sms.Transaction_ID__c = '1b9f8ac8eb75494e80f1474aeb61d93d';
        
        insert sms;
        List<Campaign> campaignList = [SELECT Id, Total_SMS_Delivered__c, Total_SMS_Failed__c, Total_SMS_Sent__c, 
				(
					SELECT Id, SMS_Delivery_Status__c 
					FROM ActivityHistories 
					WHERE (ActivityType = 'SMS') AND (Status = 'Completed')
				) 
			FROM Campaign 
			WHERE (IsActive = TRUE)];
        if(!campaignList.isEmpty()) {

        cam1.Total_SMS_Delivered__c = 0;
        cam1.Total_SMS_Sent__c = 0;
        cam1.Total_SMS_Failed__c = 0;
        }
        update cam1;
        

        Test.StartTest();

        SmsCounterBatch counterBatch = new SmsCounterBatch();
     	
     	Database.executeBatch(counterBatch);
	    
	    Test.StopTest();   
        System.AssertEquals(database.countquery('SELECT COUNT()'+' FROM SMS__c'), 21);
    }
}

And here the uncovered part of the Batch class:

User-added image

I will appreciate any kind of help.
Thank you
I was working on the Customize Your Login Process with My Domain module and I accidentally changed my domain of my Hands-On Org. Is it possible to change it back to what it was? I get an error message now when I try to launch my hands-on org. L

My former Hands On Org. URL is as follows: curious-badger-397879-dev-ed.my.salesforce.com

The domain I changed it to is: mylightsaber.dom-dev-ed.my.salesforce.com
 
NOT (ISPICKVAL( Transfer_ID__r.Transfer_Type__c , 'Store to WHS') AND (Shipping_Quantity__c > Serial_No__r.Quantity_available__c ))

I am getting ) missing in thie validation rule, Can someone help?

System.QueryException: List has more than 1 row for assignment to SObject
Class.AccountSearchUI.<init>: line 13, column 1

My VF Page

<apex:page standardController="Account" extensions="AccountSearchUI">
<head>
<title>Account Search UI</title>
<style type="text/css"> </style>
</head>

<body>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
        <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
        <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
        <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    <tr>
        <td bgcolor="#FFFFFF"></td>
        <td bgcolor="#FFFFFF"></td>
        <td bgcolor="#FFFFFF"></td>
      </tr>
    <tr>
        <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
        <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
        <td height="5" bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF" valign="top">
        <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" class="tablemain">
            <tr><td height="1"></td></tr>
            <tr><td height="50" class="headingmain">&nbsp;Account Search UI</td></tr>
            <tr>
                <td align="center">
                  <table width="100%" border="0" cellspacing="0" cellpadding="1" class="tablemain">
                    <tr>
                      <td width="10%" height="23" class="headingsub1">Group Org Acc</td>
                      <td width="10%" height="23" class="headingsub1">Vertical</td>
                      <td width="10%" height="23" class="headingsub1">Account Name</td>
                      <td width="10%" height="23" class="headingsub1">Type</td>
                      <td width="10%" height="23" class="headingsub1">Owner Last Name</td>
                      <td width="10%" height="23" class="headingsub1">Client Rank</td>
                      <td width="10%" height="23" class="headingsub1">Account Plan</td>
                      <td width="10%" height="23" class="headingsub1">Last Modified</td>
                      <td width="10%" height="23" class="headingsub1">View Latest PDF</td>
                      <td width="10%" height="23" class="headingsub1">PDF Upload Date</td>
                    </tr>
                    <apex:repeat value="{!accPList}" var="cp">
                    <tr>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Group_Org__c}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Vertical__c}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Name}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Type}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Client_Rank__c}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Group_Org__c}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Vertical__c}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Name}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Type}"/></td>
                        <td height="23" class="headingsub1"><apex:outputField value="{!cp.Client_Rank__c}"/></td>
                    </tr>
                    </apex:repeat>
          </table>
        </td>
        
      </tr>
    </table></td>
    <td bgcolor="#FFFFFF" valign="top"></td>
    <td bgcolor="#FFFFFF" valign="top"></td>
  </tr>
  
  <tr>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF">&nbsp;</td>
  </tr>

</table>

</body>

</apex:page>

APEX Class
public with sharing class AccountSearchUI{    

    public ApexPages.StandardController stdController {get; set;}
    public Account acc {get; set;}
    public Account accPList {get; set;}
    
    public String accountName ='';
    public AccountSearchUI(ApexPages.StandardController stdController){
    this.stdController = stdController;

 accPList = [select Group_Org__c, Vertical__c, Name, Type, Client_Rank__c from Account where Top_25_Client__c = true and Client_Rank__c < 26 order by Client_Rank__c ASC limit 5];
    }
}
Can anyone help with the issue.
 
This is my code
=============
global class BatchApex implements Database.Batchable<sobject>{
    global Database.QueryLocator start(Database.BatchableContext bc){
        return Database.getQueryLocator('select id from Opportunity');
        
    }
    global void execute(Database.BatchableContext bc,List<Opportunity>scope){
        for(Opportunity o:scope){
            o.Name='sandhya';
        }
    update scope;
}
    global void finish(Database.BatchableContext bc){
            
   Messaging.SingleEmailMessage[] mail=new Messaging.SingleEmailMessage();
        String[] toAddresses=new String[] {'forcesfdcloud@gmail.com'};
            mail.setToAddresses(toAddresses);
        mail.setSubject('sending mail ');
        mail.setPlainTextBody('process completed success fully');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
      
    }
    }
I want to update my opportunities. After updating the opportunities i want to send a mail to the above mentioned address, but it shows error like" Illegal assignment from Messaging.SingleEmailMessage to List<Messaging.SingleEmailMessage>" can any one tell me how to solve this issue.
trigger CheckValidationonCaseClose on Case (after update) {     
for(Case e:Trigger.New){          
Case d=Trigger.oldMap.get(e.Id);         
if(d.Signature_Required__c==true && d.Customer_Signature_Status__c!='Completed' && e.IsClosed==true)
{  
e.adderror('Cannot Close Case');
}

its urgent
}  
Hi,

I have a rquirement to format a time which is given in HH:MM format (24-hour clock) into the user's locale. I assumed that there would be a fromat() method as the DateTime class does, but it does not exist.

Any ideas how I can do this?

Thanks
I have a Salesforce App which passed security review for the first time in the last year. This App also includes integration with external web application, due to this I also submitted a BURP scan report of the external web application. I am not sure about how Salesforce conducts periodic security review and have some queries.

As you may know, Salesforce provides periodic, point-in-time review at an interval determined by salesforce.com (typically anywhere between 6 months to 2 years).

• As per Salesforce documentation for already passed Apps, around the expiry date, Salesforce contacts partners to arrange another review. Can you guide me on how much time Salesforce gives us to prepare for Security Review?

• BURP scan and fixing the issues reported by it can take time. If I could not submit a clean BURP scan report within the time frame provided by Salesforce, Does Salesforce remove package from AppExchange?

• Salesforce charges for Security Review process for paid Apps, as one-time upfront fee, and a small subsequent annual fee. Can you guide me on how much subsequent annual fee Salesforce charges to partners? Salesforce also charges annual listing fee of $150 USD. Is that correct?

Kindly help me with this. Thanks in advance.
Hi All,

I want to disable the global search for particular users,i have disabled the chatter in chatte section,please give me suggestion how to disable the global search.
see the below screen shot where i have disabled
User-added image

see the below screen shot for what i want to disable 

User-added image

Thanks,
Surya
I'm stuck on only one unit for this module; the controlling access to fields unit:

"Two team members need to view and update Accounts, but only one should be able to see and edit the Rating field. Create one profile and one permission set with field level security to solve for this use case.The profile must be named 'Basic Account User' and result in an API name of 'Basic_Account_User'. It should use the 'Salesforce' user license type.
The permission set must be named ‘Account Rating’ and result in an API name of 'Account_Rating'."

"Challenge Not yet complete... here's what's wrong:
The 'Basic Account User' profile did not have the appropriate object and field-level security for the Account object "
  • February 02, 2016
  • Like
  • 1
Hi Jacob,

I have already completed 5 badges, but still no email for obtaining the Cloak of Adventure sweatshirt. Does it take username or email address for sending emails, as my email address and user name are different.

User-added image
Hi,

I want to send an email alert to task owner if they have any open task which due date is already passed.
I want to send it 1 day after due date and 1 week after due date.
Please suggest how I can achieve it because through workflow it is not achievable.

Regards
Emily
 view state and need a steps how can we reduce view state without help of transient
Hi,

I have executed "Run all test" to get code coverage of all apex classes. Is there way to get all apex classes code coverage with percentage copy to excel sheet. I am able to see all classes with percentage in Developer console. But not able to copy all those. Please provide some suggestion.
We are using Apex Data Loader 19.0 and cliq_process.  Using Apex Data Loader & Cliq_process, we are exporting the data into salesforce custom object. The process was working fine past 2 years and till last week. Last few days we are getting the below error.


2015-08-17 06:12:31,218 INFO  [ExportRevenue] process.ProcessRunner run (ProcessRunner.java:104) - Logging in to: https://www.salesforce.com/services/Soap/u/19.0
2015-08-17 06:12:31,233 INFO  [ExportRevenue] client.PartnerClient login (PartnerClient.java:989) - Beginning Partner Salesforce login ....
2015-08-17 06:12:31,249 INFO  [ExportRevenue] client.PartnerClient login (PartnerClient.java:998) - Salesforce login to https://www.salesforce.com/services/Soap/u/19.0/services/Soap/u/19.0 as user forceuser@<company>.com
2015-08-17 06:12:31,655 INFO  [ExportRevenue] dao.DataAccessObjectFactory getDaoInstance (DataAccessObjectFactory.java:51) - Instantiating data access object: C:\Program Files\salesforce.com\Apex Data Loader 19.0\cliq_process\ExportRevenue\write\ExportRevenue.csv of type: csvWrite
2015-08-17 06:12:31,655 INFO  [ExportRevenue] process.ProcessRunner run (ProcessRunner.java:109) - Checking the data access object connection
2015-08-17 06:12:31,655 INFO  [ExportRevenue] process.ProcessRunner run (ProcessRunner.java:114) - Setting field types
2015-08-17 06:12:31,766 ERROR [ExportRevenue] client.PartnerClient describeSObject (PartnerClient.java:1249) - Error while calling web service operation: describeSObject, error was: Failed to send request to https://ncst.my.salesforce.com/services/Soap/u/19.0/00D400000009okc
com.sforce.ws.ConnectionException: Failed to send request to https://<company>.my.salesforce.com/services/Soap/u/19.0/00D400000009okc
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:113)
    at com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java:48)
    at com.salesforce.dataloader.client.PartnerClient.describeSObject(PartnerClient.java:1240)
    at com.salesforce.dataloader.client.PartnerClient.setFieldTypes(PartnerClient.java:1196)
    at com.salesforce.dataloader.controller.Controller.setFieldTypes(Controller.java:127)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:115)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:229)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:847)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:815)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1025)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1038)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:402)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:170)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:836)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
    at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
    at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:82)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
    ... 6 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145)
    at sun.security.validator.Validator.validate(Validator.java:203)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172)
    at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:840)
    ... 19 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:236)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216)
    ... 24 more
2015-08-17 06:12:31,766 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:214) - Unable to run process ExportRevenue
java.lang.RuntimeException: com.sforce.ws.ConnectionException: Failed to send request to https://<company>.my.salesforce.com/services/Soap/u/19.0/00D400000009okc
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:139)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:229)
Caused by: com.sforce.ws.ConnectionException: Failed to send request to https://<company>.my.salesforce.com/services/Soap/u/19.0/00D400000009okc
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:113)
    at com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java:48)
    at com.salesforce.dataloader.client.PartnerClient.describeSObject(PartnerClient.java:1240)
    at com.salesforce.dataloader.client.PartnerClient.setFieldTypes(PartnerClient.java:1196)
    at com.salesforce.dataloader.controller.Controller.setFieldTypes(Controller.java:127)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:115)
    ... 1 more
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:847)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:815)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1025)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1038)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:402)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:170)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:836)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
    at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
    at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:82)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
    ... 6 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221)
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:145)
Exact replication steps:
1. Create a connected app
2. Add the callback URL to that connected app as the URL of a VF page. For Eg - 'https://c.eu2.visual.force.com/apex/mypage'.
3. Connect to another salesforce org of the same instance.Énter the login details ie username and password
4. Allow permission to the connected app create on your source org to access info about target org by clicking on Állow Button'
5. Instead of redirecting back to source org it redirects me to the target org and tries to open up the page mentioned in the callback url.
6. This issue is coming when my source and target org are on same instance. It works fine when source and target instances are different.
Hello,
I have some queries on release versioning and listing subsequent versions on AppExchange:
  1. Can I release and maintain 2 versions on AppExchange? In other words, if there a v1.0 that is listed on AppExchange, and we release a new version v1.1 that has passed Security Review and ready to be listed on AppExchange, does it automatically replace the v1.0 that was listed earlier? 
  2. Do the existing customer orgs get any notification of a new released version? If yes, does it automatically contain the install link? If not, what is the most preferred practice?
  3. If I deprecate an earlier version, do the customer orgs using this version get a notification to upgrade? Are they forced to upgrade?
  4. If a patch is created for a particular released version, do I have to manually inform all customer orgs using it? Or do they get automatic notifications of the same and can choose to apply the patch as needed?
Thanks in advance!
Hi,

I want to develop an "Open CTI Adapter", where can I find the documentation(API/Library) for the same?

Regards,
Rohan
Hi ,
  
 I'm trying to parse Account records to JSON string. But I'm getting unnecessary data like attributes(type,url) that is not required in String.

Can any one pls help me in how to parse the string to required format.
List<Account> accnts=[Select Name,Phone From Account];
String s=JSON.serialize(accnts);
The resulting output is in below fromat..
{
  "attributes" : {
    "type" : "Account",
    "url" : "/services/data/v34.0/sobjects/Account/00128000002trGGAAY"
  },
  "Name" : "GenePoint",
  "Phone" : "(650) 867-3450",
  "Id" : "00128000002trGGAAY"
}


My requirement is to generate resulting String as below JSON string format.
 
{
  "Name" : "GenePoint",
  "Phone" : "(650) 867-3450",
  "Id" : "00128000002trGGAAY"
}

So that I can minimize the data to to be sent the the client system.

Any help is really appreciated. Thanks in advance.

Regards,
Naveen.
I need to download Contacts Near By component for the trailhead - field sales app project but I am not able to find it on appexchange. Any idea where can I get it from?