• Ken Fitzpatrick 10
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies
So, I have a very strange issue. I have the following code:
private static List<Id> getCaseRecordTypes(String acctMgrType){
        List<Id> caseRecordTypeIds = new List<Id>(); //Id list to return
        //System.debug(LoggingLevel.ERROR, '*** Kentest --> ' + caseRecordTypeIds);
        Map<String, ID> caseTypes = ObjectHelper.GetRecordTypeIdsByDeveloperName(Case.SObjectType);
        
        String accountMgrTypeValue = acctMgrType + '_Case_Record_Types';
        Account_Manager_Assignment_Config__mdt amac = acctMgrAssignmentConfig_map.get(accountMgrTypeValue);
        
        //If we have values for this label then lets set those values after we check and split the string up.
        //Otherwise set some default values.
        if(amac != null){
            List<String> caseTypeArray = new List<String>();
            //Make sure the string is not blank before we try to split based off the key passed in.
            //If it is blank then set some default values.
            if(String.isNotBlank(amac.Value__c)){
                caseTypeArray = amac.Value__c.split(',');
                
                for(String cta : caseTypeArray){
                    caseRecordTypeIds.add(caseTypes.get(cta.trim()));
                }
            } else {
                if(acctMgrType.equals('TAM')){
                    caseRecordTypeIds.add(caseTypes.get('Support_Cases'));
                } 
                if(acctMgrType.equals('SAM')){
                    caseRecordTypeIds.add(caseTypes.get('Success_Team_Cases'));           
                }
            }
        } else {
            //Set Defaults if non are set prior
            if(acctMgrType.equals('TAM')){
                caseRecordTypeIds.add(caseTypes.get('Support_Cases'));
            } 
            if(acctMgrType.equals('SAM')){
                caseRecordTypeIds.add(caseTypes.get('Success_Team_Cases'));           
            }
        }
        
        return caseRecordTypeIds;
    }
When I call this method with "SAM", I should get back a list of two case record type id's, but I am not. I am only getting what should be the first record id in the list.

If I uncomment the System.Debug statement right after the List<Id> initialization, I get both record type id's like I should. This manifests itself in two different ways in two different environments. In one environment, a test method assertion fails, but it works fine when I am using the functionality as the user would in Salesforce, while in another environment it doesn't work for the user (I haven't tried the test method yet). 

Mainly, what I am looking for is any possible explanation as to why putting the System.Debug statement would cause the List to eventually be built correctly (with the two expected case record ids) and when removing or commenting out the System.Debug the List appears to have only one value in the List. It literally comes down to me "fixing" the issue by just adding a System.Debug statement to view the initialized empty list. Does anyone know anything about what could be going on behind the scenes when Salesforce is executing this code? 

Thanks for any insight. Just to be clear, I am not looking for anyone to solve this issue, I am looking for possible explanations as to why I am seeing this strange behavior when adding the System.Debug or any ideas on what else I could try to look at.
I am building a group of radio buttons using an Aura:Iteration and Lightning:Input Type="Radio". I am setting checked to true on the default option for a particular profile. The one I want to check is being checked, but the first radio button is still highlighted. I am trying to figure out how to highlight the checked option instead of the first or at least just unhighlight the first.

Here is a screenshot showing what I am talking about:
User-added image

You can see the first option is highlighted, not the checked option.

I tried to use a Lighting:RadioGroup, but I can't get the descriptions below each option in a radio group, so I decided on the iteration and input. Here is my markup:
<aura:iteration items="{!v.recordTypes}" 
				var="rType" 
				indexVar="idx">
	<lightning:input aura:id="rType_{!idx}" 
					 name="rTypeRadioGroup" 
					 type="radio" 
					 label="{!rType.name}" 
					 checked="{!rType.selected}" 
					 onchange="{!c.radioSelected}"/>
	<div class="slds-p-left_large">
		<div class="slds-p-left_large slds-text-heading_small">
			{!rType.description}
		</div>
	</div><br />
</aura:iteration>
Any ideas?

Thanks in advance!
 
As part of a project ot Lightning enable some functionality, I removed an old test class. During the validation portion of the deploy to our UAT sandbox, it was discovered that a particular trigger was getting 0% code coverage. Is there a simple way to see what apex classes and triggers get touched/tested by a test class before deleting it? It appears the only way to do the validation and find out. It would be nice to run a test class and see a list of classes and triggers that received code coverage from that test class.

Thanks!
So, I have a very strange issue. I have the following code:
private static List<Id> getCaseRecordTypes(String acctMgrType){
        List<Id> caseRecordTypeIds = new List<Id>(); //Id list to return
        //System.debug(LoggingLevel.ERROR, '*** Kentest --> ' + caseRecordTypeIds);
        Map<String, ID> caseTypes = ObjectHelper.GetRecordTypeIdsByDeveloperName(Case.SObjectType);
        
        String accountMgrTypeValue = acctMgrType + '_Case_Record_Types';
        Account_Manager_Assignment_Config__mdt amac = acctMgrAssignmentConfig_map.get(accountMgrTypeValue);
        
        //If we have values for this label then lets set those values after we check and split the string up.
        //Otherwise set some default values.
        if(amac != null){
            List<String> caseTypeArray = new List<String>();
            //Make sure the string is not blank before we try to split based off the key passed in.
            //If it is blank then set some default values.
            if(String.isNotBlank(amac.Value__c)){
                caseTypeArray = amac.Value__c.split(',');
                
                for(String cta : caseTypeArray){
                    caseRecordTypeIds.add(caseTypes.get(cta.trim()));
                }
            } else {
                if(acctMgrType.equals('TAM')){
                    caseRecordTypeIds.add(caseTypes.get('Support_Cases'));
                } 
                if(acctMgrType.equals('SAM')){
                    caseRecordTypeIds.add(caseTypes.get('Success_Team_Cases'));           
                }
            }
        } else {
            //Set Defaults if non are set prior
            if(acctMgrType.equals('TAM')){
                caseRecordTypeIds.add(caseTypes.get('Support_Cases'));
            } 
            if(acctMgrType.equals('SAM')){
                caseRecordTypeIds.add(caseTypes.get('Success_Team_Cases'));           
            }
        }
        
        return caseRecordTypeIds;
    }
When I call this method with "SAM", I should get back a list of two case record type id's, but I am not. I am only getting what should be the first record id in the list.

If I uncomment the System.Debug statement right after the List<Id> initialization, I get both record type id's like I should. This manifests itself in two different ways in two different environments. In one environment, a test method assertion fails, but it works fine when I am using the functionality as the user would in Salesforce, while in another environment it doesn't work for the user (I haven't tried the test method yet). 

Mainly, what I am looking for is any possible explanation as to why putting the System.Debug statement would cause the List to eventually be built correctly (with the two expected case record ids) and when removing or commenting out the System.Debug the List appears to have only one value in the List. It literally comes down to me "fixing" the issue by just adding a System.Debug statement to view the initialized empty list. Does anyone know anything about what could be going on behind the scenes when Salesforce is executing this code? 

Thanks for any insight. Just to be clear, I am not looking for anyone to solve this issue, I am looking for possible explanations as to why I am seeing this strange behavior when adding the System.Debug or any ideas on what else I could try to look at.
I am building a group of radio buttons using an Aura:Iteration and Lightning:Input Type="Radio". I am setting checked to true on the default option for a particular profile. The one I want to check is being checked, but the first radio button is still highlighted. I am trying to figure out how to highlight the checked option instead of the first or at least just unhighlight the first.

Here is a screenshot showing what I am talking about:
User-added image

You can see the first option is highlighted, not the checked option.

I tried to use a Lighting:RadioGroup, but I can't get the descriptions below each option in a radio group, so I decided on the iteration and input. Here is my markup:
<aura:iteration items="{!v.recordTypes}" 
				var="rType" 
				indexVar="idx">
	<lightning:input aura:id="rType_{!idx}" 
					 name="rTypeRadioGroup" 
					 type="radio" 
					 label="{!rType.name}" 
					 checked="{!rType.selected}" 
					 onchange="{!c.radioSelected}"/>
	<div class="slds-p-left_large">
		<div class="slds-p-left_large slds-text-heading_small">
			{!rType.description}
		</div>
	</div><br />
</aura:iteration>
Any ideas?

Thanks in advance!
 
Hello

I'm doing a bit of code where I'm checking if a Work Type Id in a Work Order is in a List for Work Type Ids, but the contains method does not seem to be detecting the match:
Code snippet 
List<ServiceAppointment> svcAppts = new List<ServiceAppointment>();

		//List of Ids where their is an auto generate feature enabled
		List<Id> listWorkTypeIds = new List<Id>();
		for ( WorkType wt : [SELECT Id FROM WorkType WHERE ShouldAutoCreateSvcAppt = TRUE] )  {
			listWorkTypeIds.add(wt.Id);
		}
		System.debug('DEBUG : Worktype count ' + listWorkTypeIds.size());

		
		for ( WorkOrder workOrder : workOrders ) {
			tempDecimal = workOrder.Crew_Size__c;
			crewSize  = tempDecimal.intValue();
			System.debug('DEBUG : crewSize: ' + crewSize);
			
			tempDecimal = workOrder.ServiceAppointmentCount;
			System.debug('DEBUG : RAW service count : ' + tempDecimal);
			System.debug('****DEBUG : list work type : ' + listWorkTypeIds[0]);
			System.debug('****DEBUG : WO work type : ' + workOrder.workTypeId);

			if (listWorkTypeIds.contains(workOrder.workTypeId)) {
				apptCount = tempDecimal.intValue() + 1;		
				System.debug('DEBUG : ADJUSTED service count : ' + tempDecimal);				
			} else {
				apptCount = tempDecimal.intValue();
				System.debug('DEBUG : SAME service count : ' + tempDecimal);
			}
Now, the debug looks like this:
08:10:49.875 (1834107162)|SOQL_EXECUTE_BEGIN|[92]|Aggregations:0|SELECT Id FROM WorkType 
08:10:49.875 (1848717624)|SOQL_EXECUTE_END|[92]|Rows:1
08:10:49.875 (1849133376)|USER_DEBUG|[95]|DEBUG|DEBUG : Worktype count 1
08:10:49.875 (1849315483)|USER_DEBUG|[101]|DEBUG|DEBUG : crewSize: 1
08:10:49.875 (1849418406)|USER_DEBUG|[104]|DEBUG|DEBUG : RAW service count : 0
08:10:49.875 (1849462073)|USER_DEBUG|[105]|DEBUG|****DEBUG : list work type : 08q0l00000001jtAAA
08:10:49.875 (1849543426)|USER_DEBUG|[106]|DEBUG|****DEBUG : WO work type : 08q0l00000001jtAAA
08:10:49.875 (1849692808)|USER_DEBUG|[113]|DEBUG|DEBUG : SAME service count : 0

So, the debug shows that the Ids are apparently the same, but the IF statement using the the contains does resolve to TRUE.

Any thoughts on what I am missing?

Regards
Andrew