• Angel HF
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi,

I am trying to create a Custom field on User object. The custom field should be a Text field as External Id and required, when I am trying to create the field I am getting the below error:

User Custom Fields that are required must have a default value.

Do you now why or possible reasons?
Hi,

I am trying to complete the trailhead module Apex Basics & Database / Writing SOQL Queries. When I am checking the challenge I got the bllow eerror:

Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Delete failed. First exception on row 0 with id 0032400000nIEIpAAO; first error: DELETE_FAILED, Your attempt to delete Joe Doe could not be completed because it is associated with the following cases.: 00001136 : []

I have not clue how to solve it, since there is not any contact named Joe Doe and any case 00001136. My code seems to be fine:
 
public class ContactSearch {

    public static List<Contact> searchForContacts (String lastName, String postalCode){
    	List<Contact> con = new List<Contact>(); 
        con = [SELECT Id FROM Contact WHERE (LastName =: lastName AND MailingPostalCode =: postalCode )];
        
        return con;
    }
}

Thanks in advance.




 
If an email is sent using a visualforce page, is it possible to add a code that counts how many times a particular email template has been sent?

Thanks in advance for your precious help.
Hi Community

I need you help

I am not able to test  a wrapper class when I am trying to cretate a class on my tesstclass I am getting always an error I tried on several ways. The last erro I got it is :

--
Constructor not defined: [defLeadContact.lead].<Constructor>()
--
I have the constructor defined

Here i share part of the code that I cannot coverage, the wrapper class

public with sharing class  defLeadContact {
    @TestVisible public contact[] contactFields {get; set;}

// here code

     AggregateResult[] results2 = Database.query(
           'SELECT count(Id) Quantity, Country Status FROM Contact WHERE CreatedDate >= 2012-08-01T00:00:00Z AND CreatedDate <= 2016-03-23T00:00:00Z GROUP BY ROLLUP(Status, Country)'
        );
        
        contactFields = new List<contact>();
        for (AggregateResult ar : results2) {
            contactFields.add(new contact(ar));
        }


    // wrapper class to hold aggregate data    
    @TestVisible public class contact {
        public Integer Quantity { get; private set; }
        public String Country { get; private set;}
        public String Status{ get; private set;}
        

        @TestVisible public contact(AggregateResult ar) {
            Quantity = (Integer) ar.get('Quantity');
            Country = (String) ar.get('Country ');
        Status= (String) ar.get('Status');
        }
        
    }
}

This is my test

@isTest
private class TestLeadContact {

    @isTest static  void testContact() {
        defLeadContact.lead l =new defLeadContact.lead();
       
        
        //some code
    }
    
}
Thanks in advanse
If an email is sent using a visualforce page, is it possible to add a code that counts how many times a particular email template has been sent?

Thanks in advance for your precious help.
Hi,

I am trying to create a Custom field on User object. The custom field should be a Text field as External Id and required, when I am trying to create the field I am getting the below error:

User Custom Fields that are required must have a default value.

Do you now why or possible reasons?
Hi Community

I need you help

I am not able to test  a wrapper class when I am trying to cretate a class on my tesstclass I am getting always an error I tried on several ways. The last erro I got it is :

--
Constructor not defined: [defLeadContact.lead].<Constructor>()
--
I have the constructor defined

Here i share part of the code that I cannot coverage, the wrapper class

public with sharing class  defLeadContact {
    @TestVisible public contact[] contactFields {get; set;}

// here code

     AggregateResult[] results2 = Database.query(
           'SELECT count(Id) Quantity, Country Status FROM Contact WHERE CreatedDate >= 2012-08-01T00:00:00Z AND CreatedDate <= 2016-03-23T00:00:00Z GROUP BY ROLLUP(Status, Country)'
        );
        
        contactFields = new List<contact>();
        for (AggregateResult ar : results2) {
            contactFields.add(new contact(ar));
        }


    // wrapper class to hold aggregate data    
    @TestVisible public class contact {
        public Integer Quantity { get; private set; }
        public String Country { get; private set;}
        public String Status{ get; private set;}
        

        @TestVisible public contact(AggregateResult ar) {
            Quantity = (Integer) ar.get('Quantity');
            Country = (String) ar.get('Country ');
        Status= (String) ar.get('Status');
        }
        
    }
}

This is my test

@isTest
private class TestLeadContact {

    @isTest static  void testContact() {
        defLeadContact.lead l =new defLeadContact.lead();
       
        
        //some code
    }
    
}
Thanks in advanse