• JeanGrey52
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I have a flow that generates a random string to update a field.  My problem I'm having is that the test class method isn't show up when I run the test, so I have 0% coverage and the test method isn't showing up in the drop down for "Code Coverage: None"

Code:
 
public with sharing class GenerateToken {
    @InvocableMethod
    
    public static void GenerateEmailToken(list<Account> accList){
        integer len = 16;
		blob blobkey = crypto.generateAesKey(128);
   		String key = EncodingUtil.convertToHex(blobKey);
		String token = key.substring(0,len);
        System.debug('Token is ' + token);
        
        accList[0].put('CX_Registration_Token__pc', token);
        update accList;
     }
}


Test Class:

@isTest
public class GenerateTokenTest {
    
    @isTest    
    Public Static void GenerateEmailToken(){
                
        list<Account> accList = new List<Account>();
        
        integer len = 16;
		blob blobkey = crypto.generateAesKey(128);
   		String key = EncodingUtil.convertToHex(blobKey);
		String token = key.substring(0,len);
        
    	Account pa = new Account(
                                FirstName='TestAccount2',
                                LastName='TestAccount2', 
                                RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Person Account').getRecordTypeId()
                               
                            );

    insert pa;
    
    accList.add(pa);
        Test.startTest();
        
        pa.CX_Registration_Token__pc = 'token';        
        update pa;
        
        System.assertEquals(token,pa.CX_Registration_Token__pc);
        Test.stopTest();
    }
   
    
}

I'm pretty much on the beginning stages of my journey of development, so it's very possible this makes zero sense how it's written.  Apologies if that's the case.  
How to count how many users are waiting for service in a specific queue?
I have some simple VF pages I am adding to the page layout of a custom object. They show up on the detail page and they show up when I click edit, however they are not showing up on the new record screen when I click the New button.

The VF pages are the text for questions I am asking and the object fields are the answers the users select. So in short, having them show up on the Create New Record screen is the most important part. 

I would normally just make a read only text field with the question as the default text, but am trying to get away from doing this as it impacts my custom field limit.

What am I doing wrong?

Here is an exame of one of the pages I am inserting on the page layout.
 
<apex:page standardController="Custom_Object__c">
  <apex:pageBlock >
  <apex:outputText >Sample Text</apex:outputText>
  <br/>
  <apex:outputText >A. Sample Text</apex:outputText>
  <br/>
  <apex:outputText >B. Sample Text</apex:outputText>
  <br/>
  <apex:outputText >C. Sample Text</apex:outputText>
  <br/>
  <apex:outputtext >D. Sample Text</apex:outputtext>
  <br/>
  <apex:outputText >Sample Text</apex:outputText>
  </apex:pageBlock>
</apex:page>

 

I am trying to run a query to find all tasks associated to Contacts that have a specific custom field value.

 

Has anyone found a way to do this?

 

I was thinking it would be through Who but I'm not sure how to make the link:

 

select Id from Task where Who.type='Contact' and whoid.customfield__c = 'whatever'

 

I know this won't work, but hopefully you get the gist of what I'm hoping to achieve.

 

TIA