• Cody Sanders 33
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 3
    Replies
I created a flow that looks up "ProfileID = [Sales Prospecting Profile ID]" in a record choice set so we can choose what sales prospecting user set up a 'solutions call' so that credit can be given. When our sales user sets it up, he is not seeing any options but when I run the flow I see them. He has access to all the User fields, but I'm sure it's a permission somewhere. Anyone know the fix for this problem?
I'm trying to use two soql queries to grab the relevant information for an email class, but it is failing when it tries to run the second query when running the test class. I'm actively stumped as to why it's not finding the created product. I'm not super experienced and mostly cut/paste things for apex, so I'm sure there's something goofed along the way. Code below:
Class:

global class EmailPTRAttWearplates implements Messaging.InboundEmailHandler {
	  global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
		  Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
          
          Production_Tracking_Record__c ptr;
          Product2 prod;
          
           ptr = 
              [select id, Product__c from Production_Tracking_Record__c
              where Name = :email.subject];
          
           prod =
              [select Wearplate__c, Wearplate_Thickness__c, Pre_Order_Wearplates__c from Product2
              where Name = :ptr.Product__c];
          
          if(prod.Pre_Order_Wearplates__c=false)
          {
           PTR_Attachment__c Att = new PTR_Attachment__c(Name=email.subject,
                                                         PTR__c=ptr.Id,
                                                         Component__c='Wearplate',
                                                         Quantity__c=2,
                                                         Thickness__c=prod.Wearplate_Thickness__c,
                                                         Material__c=prod.Wearplate__c,
                                                         Directory_Link_Text__c='R:\\Parts Orders\\Internal Laser Parts');
          insert Att;
          }
       return result;
      }
}



Test Class:

@IsTest
public class EmailPTRAttWearplates_Test {
 public static list<Production_Tracking_Record__c> PTRlist;
    static testMethod void myTest() {
   		Messaging.InboundEmail email  = new Messaging.InboundEmail();
        Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
    
    		email.fromAddress = 'test@test.com';
    		email.subject = '12345';
   
    Test.startTest();
    
        
        Account acct = new Account(Name='Test Account',
                                   Type='Direct Customer',
                                   Shipping__c='Prepaid',
                                   Ship_Via__c='UTS',
                                   Sales_Discount__c=0);
        insert acct;
        
        Product2 prod = new Product2(Name='Test Product',
                                     Rotor_Configuration__c='Closed Adjustable',
                                     Inboard_or_Outboard__c='Outboard',
                                     Endcap_Face_Preparation__c='Wearplate',
                                     Wearplate__c='Mild Steel',
                                     Wearplate_Thickness__c='.375',
                                     Pre_Order_Wearplates__c=false,
                                     Vane_Thickness__c='.375',
                                     Vane_Material__c='AR500',
                                     Shroud_Mat__c='Mild Steel',
                                     Shroud_Thickness__c='.375',
                                     Adjustable_Blade_Thickness__c='0.3125',
                                     Blade_Mat__c='Mild Steel');
        insert prod;
        
        Opportunity opp = new Opportunity(Name='12345',
                                          RA__c='12345',
                                          StageName='Quote Sent',
                                          CloseDate=System.today(),
                                          AccountId=acct.Id,
                                          Make__c='Kice',
                                          Model__c='VJ 14x10x10',
                                          Product__c=prod.Id,
                                          Max_Temp__c='120',
                                          Serial__c='N/A',
                                          Cold_Clr_Radial__c='.004-.007',
                                          Cold_Clr_Side__c='.004-.007');
        
        insert opp;
    		
        Production_Tracking_Record__c ptr = new Production_Tracking_Record__c(Name = '12345',
        																	  RA__c = opp.Id,
            																  Product__c = prod.Id);
        insert ptr; 
        
        EmailPTRAttWearplates paw = new EmailPTRAttWearplates();
        
        Messaging.InboundEmailResult result = paw.handleInboundEmail(email, env);
        
    Test.stopTest();
    
        System.assert (result.success, 'InboundEmailResult returned a failure message');
    
    }
}

 
I've created a mobile app that contains a flow where the user uses a barcode scanner to enter a job number and verify that the number is valid. The device being used is an iPad and so far my roadblock is that you can't tab over to the "Next" button like you can on Android devices. On said Android devices, the scanner I have connected to them has a suffix of a horizontal tab, then space to press the "Next" button, but it appears that ios devices don't have a similar function with how the components are rendered. Has anyone been able to overcome this obstacle? My boss is very adamant that they cannot interact with the screen to press "Next" and I'm dead in the water until I can figure it out.
I'm working for a client and they would like to use the functionality of the standard Log a Call global action, but with a couple tweaks such as prompting the user to answer if a follow-up needs to be created. It seems silly to me that I can't find a simple answer on being able to use a global action in a Visualforce page, but it doesn't change the fact that I still need it.
The reason I can't just make an apex:form like normal is it doesn't render the Subject field with the picklist values and also doesn't have the ability to add multiple contacts to the task in the same line, as well as just not looking as nice. Is there a VF markup that I'm missing that can do this or is it more complicated than that?
I'm currently working on a sandbox record creation class so I can prepopulate a couple records when refreshing sandboxes. However, I'm very inexperienced with Apex code and am hitting query limits, most likely because I'm having to look up the records previously created in the class. Is there a way that I can set the newly created record in the class so that I can then use the record ID as a variable in later methods? Basically all the queries here should be variables.
Here's the class:
public class SandboxClass {
    // Use this method to insert the accounts, the contacts, and the donations
    // you will need one method per object here is the account method
    public Account InsertCouplesAccount(){
        Account Acct1 = new Account();
        Acct1.Name='Couples Household';
        Acct1.Type='Household';
        Acct1.Location__c='City';
        Acct1.BillingCity ='City';
        Acct1.BillingCountry='United States';
        Acct1.BillingStreet='123 Test St.';
        Acct1.BillingState='Illinois';
        Acct1.BillingPostalCode='12345';   
        
        
        insert Acct1;
        return Acct1;
    } 
    public  Account InsertSingleAccount() {
    	Account Acct2 = new Account();
        Acct2.Name='Single Household';
        Acct2.Type='Household';
        Acct2.Location__c='Town';
        Acct2.BillingCity ='Indescript City';
        Acct2.BillingCountry='United States';
        Acct2.BillingStreet='321 Testing St.';
        Acct2.BillingState='Illinois';
        Acct2.BillingPostalCode='54321';
        
        insert Acct2;
        return Acct2;
    } 
    public Contact InsertHusbandContact() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact HusbCon = new Contact();
        HusbCon.Salutation = 'Mr.';
        HusbCon.FirstName = 'John';
        HusbCon.LastName = 'Couples';
        HusbCon.AccountId = Acct.Id;
        
        insert HusbCon;
        return HusbCon;
    }
    public Contact InsertWifeContact() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact HusbCon = [SELECT Id FROM Contact WHERE LastName = 'Couples'];
        Contact WifeCon = new Contact();
        WifeCon.Salutation = 'Mrs.';
        WifeCon.FirstName = 'Jane';
        WifeCon.LastName = 'Couples';
        WifeCon.AccountId = Acct.Id;
        WifeCon.Spouse__c = HusbCon.Id;
        
        insert WifeCon;
        return WifeCon;
    }
    public Contact UpdateHusbandContact() {
        Contact HusbCon = [SELECT Id FROM Contact WHERE FirstName = 'John'];
        Contact WifeCon = [SELECT Id FROM Contact WHERE FirstName = 'Jane'];
        HusbCon.Spouse__c = WifeCon.Id;
        
        update HusbCon;
        return HusbCon;
    }
    public Contact InsertSingleContact() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact SingCon = new Contact();
        SingCon.Salutation = 'Mr.';
        SingCon.FirstName = 'Jack';
        SingCon.LastName = 'Single';
        SingCon.AccountId = Acct.Id;
        
        insert SingCon;
        return SingCon;
    }
    public Opportunity InsertCoupleDonation1() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'John'];
        Opportunity Don1 = new Opportunity();
        Don1.AccountId = Acct.Id;
        Don1.Contact__c = Cont.Id;
        Don1.StageName = 'Posted';
        Don1.Name = 'Couple Donation 1';
        Don1.Amount = 15;
        Don1.CloseDate = System.today();
        Don1.Location__c = 'City';
        Don1.Method_of_Payment__c = 'Cash';
        Don1.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don1;
        return Don1;
    }
    public Opportunity InsertCoupleDonation2() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jane'];
        Opportunity Don2 = new Opportunity();
        Don2.AccountId = Acct.Id;
        Don2.Contact__c = Cont.Id;
        Don2.StageName = 'Posted';
        Don2.Name = 'Couple Donation 2';
        Don2.Amount = 20;
        Don2.CloseDate = System.today();
        Don2.Location__c = 'Town';
        Don2.Method_of_Payment__c = 'Credit Card';
        Don2.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don2;
        return Don2;
    }
    public Opportunity InsertSingleDonation1() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jack'];
        Opportunity Don3 = new Opportunity();
        Don3.AccountId = Acct.Id;
        Don3.Contact__c = Cont.Id;
        Don3.StageName = 'Posted';
        Don3.Name = 'Single Donation 1';
        Don3.Amount = 10;
        Don3.CloseDate = System.today();
        Don3.Location__c = 'City';
        Don3.Method_of_Payment__c = 'Cash';
        Don3.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don3;
        return Don3;
    }
    public Opportunity InsertSingleDonation2() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jack'];
        Opportunity Don4 = new Opportunity();
        Don4.AccountId = Acct.Id;
        Don4.Contact__c = Cont.Id;
        Don4.StageName = 'Posted';
        Don4.Name = 'Single Donation 2';
        Don4.Amount = 25;
        Don4.CloseDate = System.today();
        Don4.Location__c = 'Town';
        Don4.Method_of_Payment__c = 'Cash';
        Don4.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don4;
        return Don4;
    }
    public Opportunity InsertSingleDonation3() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jack'];
        Opportunity Don5 = new Opportunity();
        Don5.AccountId = Acct.Id;
        Don5.Contact__c = Cont.Id;
        Don5.StageName = 'Posted';
        Don5.Name = 'Single Donation 3';
        Don5.Amount = 45;
        Don5.CloseDate = System.today();
        Don5.Location__c = 'Town';
        Don5.Method_of_Payment__c = 'Cash';
        Don5.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don5;
        return Don5;
    }
}

 
Hello, i'm an admin who is rather inexperienced at Apex but this project was kind of dumped in my lap by a developer who has other positions he's filling right now, and I am in need of help since I can't find an answer to my particular problem. I am trying to test this query class and the test class keeps bringing the "attempt to de-reference a null object" error and I'm super confused. It's referring to line 6 in the test class so something with invoking the class is off, it seems but my lack of knowledge isn't particularly helping me figure out what I need to do. I'll leave the code for the class and test class below:
Class
public class AlroOrderBoMQuery {
	public Production_Tracking_Record__c custObj;
    public string HsgMat { get; set; }
    public string ECMat { get; set; }
    public string WPMat { get; set; }
    public string ThrtMat { get; set; }
    public string LnrMat { get; set; }
    
public AlroOrderBoMQuery(){
    }    
    
    public AlroOrderBoMQuery(ApexPages.StandardController controller){
        custObj=(Production_Tracking_Record__c)controller.getRecord();
        
           }
		Production_Tracking_Record__c ptr = [Select Id, Name, Product__c from Production_Tracking_Record__c where id =: custObj.Id limit 1];
    	
    	Product2 prod = [Select Id, Housing_Assembly__c, Drive_Endcap_Assembly__c, Tail_Endcap_Assembly__c, Housing_Material__c, Liner_Material__c, Endcap_Material__c, Wearplate__c, Housing_Throat_Plates__c from Product2 where id =: ptr.Product__c limit 1];
    	{
        HsgMat = prod.Housing_Material__c;
        ECMat = prod.Endcap_Material__c;
        WPMat = prod.Wearplate__c;
        ThrtMat = prod.Housing_Throat_Plates__c;
        LnrMat = prod.Liner_Material__c;
    	}
		List<Housing_Assembly_Attachment__c> HsgAsmAtt = [SELECT Quantity__c, Name, Id, Housing_Assembly__c FROM Housing_Assembly_Attachment__c WHERE Housing_Assembly__c =: prod.Housing_Assembly__c];
    	public List<Housing_Assembly_Attachment__c> getHsgAsmAtt() {
        return HsgAsmAtt;
    	   }
    	List<Endcap_Assembly_Attachment__c> DECAsmAtt = [SELECT Quantity__c, Name, Id, Endcap_Assembly__C FROM Endcap_Assembly_Attachment__c WHERE Endcap_Assembly__c =: prod.Drive_Endcap_Assembly__c];
    	public List<Endcap_Assembly_Attachment__c> getDECAsmAtt() {
        return DECAsmAtt;
    	   }
    	List<Endcap_Assembly_Attachment__c> TECAsmAtt = [SELECT Quantity__c, Name, Id, Endcap_Assembly__C FROM Endcap_Assembly_Attachment__c WHERE Endcap_Assembly__c =: prod.Tail_Endcap_Assembly__c];
    	public List<Endcap_Assembly_Attachment__c> getTECAsmAtt() {
        return TECAsmAtt;
    	}

    	
}

Test Class
@isTest
    private class TestAlroOrderBoMQuery {
        public static List<Opportunity> OpportunityList;
    
      static testMethod void TestAlroOrderBoMQuery() {
          AlroOrderBoMQuery BOM = new AlroOrderBoMQuery();

         
        Make__c make = new Make__c(Name='Kice');
        insert make;
        Model__c model = new Model__c(Name='Kice VJ 14x10x10',
                                     Make__c=make.Id,
                                     Product_Passage__c='Drop Thru');
        insert model;
        Housing_Assembly__c hsasm = new Housing_Assembly__c(Name='Kice Housing 1',
                                                            Model__c=model.Id,
                                                            Product_Passage__c='Drop-Through',
                                                            Housing_Type__c='Rebuild',
                                                            verified__c=true);
        insert hsasm;
        Housing_Assembly_Attachment__c hsasmatt = new Housing_Assembly_Attachment__c(Name='Drawing 1',
                                                                                    Housing_Assembly__c=hsasm.Id,
                                                                                    Quantity__c=1);
        insert hsasmatt;
        Attachment hsgatt = new Attachment(Name='Test Housing Attachment.jpg',
                                        ParentId=hsasmatt.Id,
                                        Body=Blob.valueOf('Test Housing Attachment'),
                                        IsPrivate=false);
        insert hsgatt;
        Endcap_Assembly__c ecasm = new Endcap_Assembly__c(Name='Kice Endcap 1',
                                                          Model__c=model.Id,
                                                          Endcap_Type__c='Rebuild',
                                                          Configuration__c='Inboard',
                                                          verified__c=true);
        insert ecasm;
        Endcap_Assembly_Attachment__c ecasmatt = new Endcap_Assembly_Attachment__c(Name='Drawing 2',
                                                                                    Endcap_Assembly__c=ecasm.Id,
                                                                                    Quantity__c=1);
        insert ecasmatt;
        Attachment ecatt = new Attachment(Name='Test Endcap Attachment.jpg',
                                        ParentId=hsasmatt.Id,
                                        Body=Blob.valueOf('Test Endcap Attachment'),
                                        IsPrivate=false);
        insert ecatt;
        Product2 prod = new Product2(Name='Test Product',
                                     Family='Kice',
                                     IsActive=true,
                                     Inboard_or_Outboard__c='Inboard',
                                     Rotor_Configuration__c='Open Fixed',
                                     Product_Passage__c='Drop Thru',
                                     Housing_Type__c='Rebuild',
                                     RecordTypeId='012G0000000qdfL',
                                     Make_Lookup__c=make.Id,
                                     Model_Lookup__c=model.Id,
                                     Housing_Assembly__c=hsasm.Id,
                                     Drive_Endcap_Assembly__c=ecasm.Id,
                                     Tail_Endcap_Assembly__c=ecasm.Id,
                                     Verified__c=true);
        insert prod;
        PricebookEntry PBE = new PricebookEntry(IsActive=true,
                                                UnitPrice=1000,
                                                UseStandardPrice=false,
                                                Pricebook2Id='01sG00000001zX0',
                                                Product2Id=prod.Id);
        insert PBE;
        Account acct = new Account(Name='Test Account',
                                   Type='Direct Customer',
                                   Shipping__c='Prepaid',
                                   Ship_Via__c='UTS',
                                   Sales_Discount__c=0);
        insert acct;
        Opportunity opp = new Opportunity(Name='12345',
                                          RA__c='12345',
                                          StageName='Quote Sent',
                                          CloseDate=System.today(),
                                          AccountId=acct.Id,
                                          Product__c=prod.Id,
                                          Make__c='Kice',
                                          Model__c='VJ 14x10x10',
                                          Max_Temp__c='120',
                                          Serial__c='N/A',
                                          Cold_Clr_Radial__c='.004-.007',
                                          Cold_Clr_Side__c='.004-.007');
        insert opp;
        Quote quote = new Quote(Name=opp.RA__c,
                                OpportunityId=opp.Id,
                                Pricebook2Id='01sG00000001zX0');
        insert quote;
        /*QuoteLineItem QLI = new QuoteLineItem(QuoteId=quote.Id,
                                              Product2Id=prod.Id,
                                              Quantity=1,
                                              PricebookEntryId=PBE.Id,
                                              UnitPrice=1000,
                                              Additional_Charges__c=0,
                                              Discounted_Amount__c=0,
                                              Core_Charge__c=0,
                                              Credit_Amount__c=0,
                                              Shipping_and_Handling__c=0,
                                              Rush_Charges__c=0);
        insert QLI; */
        
        
        Test.startTest();
        Production_Tracking_Record__c PTR = new Production_Tracking_Record__c(Name='12345',
                                                                              RA__c=opp.Id,
                                                                              Product__c=prod.Id,
                                                                              Housing_and_Endcaps_Order_Date__c=null,
                                                                              Shaft_Steps_on_Drive_End__c='1');
        insert PTR;
                  
        Test.stopTest();
        
        Production_Tracking_Record__c newptr = [ select id from Production_Tracking_Record__c where id =: BOM.custObj.Id];
        System.assertNotEquals('', BOM.custObj.Id, 'There is no ID');
        
        
    }
}
When I save there's not an error, but tests keep failing. If anyone could help, I'd greatly appreciate it! 
I'm trying to create a related list in the Lightning App Builder for our engineers to be able to find the next job they need to grab, housed in Salesforce on the Opportunity object. The problem is that when I select the object, Opportunity (or Airlock as we have renamed it) is not an option, despite account and other standard objects and several custom objects being available to be selected. Is there a way to enable the object or is there just a piece to the puzzle missing? 
I had a ticket from a salesman come in the other day saying that they couldn't add an email in because salesforce locked him out due to an underscore in the domain name. Is this a salesforce-native validation and if so, is there a work-around? The last thing I want is for people to be forced to input wrong information.
We are using scratch orgs for our development and are facing very peculiar issue. Even when Knowledge feature is already ENABLED in the orgs, when we are pushing the code to our org or even when we are running simple query on SObject Knowledge__kav object.

Query below is giving this error
SELECT Id, Title FROM Knowledge__kav

Error: sObject type 'Knowledge__kav' is not supported

Pushing code with a Tab attached to standard Knowledge__kav object to scratch org is giving error:
no CustomObject named Knowledge__kav found

Any help is highly appreciated.
I'm currently working on a sandbox record creation class so I can prepopulate a couple records when refreshing sandboxes. However, I'm very inexperienced with Apex code and am hitting query limits, most likely because I'm having to look up the records previously created in the class. Is there a way that I can set the newly created record in the class so that I can then use the record ID as a variable in later methods? Basically all the queries here should be variables.
Here's the class:
public class SandboxClass {
    // Use this method to insert the accounts, the contacts, and the donations
    // you will need one method per object here is the account method
    public Account InsertCouplesAccount(){
        Account Acct1 = new Account();
        Acct1.Name='Couples Household';
        Acct1.Type='Household';
        Acct1.Location__c='City';
        Acct1.BillingCity ='City';
        Acct1.BillingCountry='United States';
        Acct1.BillingStreet='123 Test St.';
        Acct1.BillingState='Illinois';
        Acct1.BillingPostalCode='12345';   
        
        
        insert Acct1;
        return Acct1;
    } 
    public  Account InsertSingleAccount() {
    	Account Acct2 = new Account();
        Acct2.Name='Single Household';
        Acct2.Type='Household';
        Acct2.Location__c='Town';
        Acct2.BillingCity ='Indescript City';
        Acct2.BillingCountry='United States';
        Acct2.BillingStreet='321 Testing St.';
        Acct2.BillingState='Illinois';
        Acct2.BillingPostalCode='54321';
        
        insert Acct2;
        return Acct2;
    } 
    public Contact InsertHusbandContact() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact HusbCon = new Contact();
        HusbCon.Salutation = 'Mr.';
        HusbCon.FirstName = 'John';
        HusbCon.LastName = 'Couples';
        HusbCon.AccountId = Acct.Id;
        
        insert HusbCon;
        return HusbCon;
    }
    public Contact InsertWifeContact() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact HusbCon = [SELECT Id FROM Contact WHERE LastName = 'Couples'];
        Contact WifeCon = new Contact();
        WifeCon.Salutation = 'Mrs.';
        WifeCon.FirstName = 'Jane';
        WifeCon.LastName = 'Couples';
        WifeCon.AccountId = Acct.Id;
        WifeCon.Spouse__c = HusbCon.Id;
        
        insert WifeCon;
        return WifeCon;
    }
    public Contact UpdateHusbandContact() {
        Contact HusbCon = [SELECT Id FROM Contact WHERE FirstName = 'John'];
        Contact WifeCon = [SELECT Id FROM Contact WHERE FirstName = 'Jane'];
        HusbCon.Spouse__c = WifeCon.Id;
        
        update HusbCon;
        return HusbCon;
    }
    public Contact InsertSingleContact() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact SingCon = new Contact();
        SingCon.Salutation = 'Mr.';
        SingCon.FirstName = 'Jack';
        SingCon.LastName = 'Single';
        SingCon.AccountId = Acct.Id;
        
        insert SingCon;
        return SingCon;
    }
    public Opportunity InsertCoupleDonation1() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'John'];
        Opportunity Don1 = new Opportunity();
        Don1.AccountId = Acct.Id;
        Don1.Contact__c = Cont.Id;
        Don1.StageName = 'Posted';
        Don1.Name = 'Couple Donation 1';
        Don1.Amount = 15;
        Don1.CloseDate = System.today();
        Don1.Location__c = 'City';
        Don1.Method_of_Payment__c = 'Cash';
        Don1.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don1;
        return Don1;
    }
    public Opportunity InsertCoupleDonation2() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Couples Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jane'];
        Opportunity Don2 = new Opportunity();
        Don2.AccountId = Acct.Id;
        Don2.Contact__c = Cont.Id;
        Don2.StageName = 'Posted';
        Don2.Name = 'Couple Donation 2';
        Don2.Amount = 20;
        Don2.CloseDate = System.today();
        Don2.Location__c = 'Town';
        Don2.Method_of_Payment__c = 'Credit Card';
        Don2.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don2;
        return Don2;
    }
    public Opportunity InsertSingleDonation1() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jack'];
        Opportunity Don3 = new Opportunity();
        Don3.AccountId = Acct.Id;
        Don3.Contact__c = Cont.Id;
        Don3.StageName = 'Posted';
        Don3.Name = 'Single Donation 1';
        Don3.Amount = 10;
        Don3.CloseDate = System.today();
        Don3.Location__c = 'City';
        Don3.Method_of_Payment__c = 'Cash';
        Don3.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don3;
        return Don3;
    }
    public Opportunity InsertSingleDonation2() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jack'];
        Opportunity Don4 = new Opportunity();
        Don4.AccountId = Acct.Id;
        Don4.Contact__c = Cont.Id;
        Don4.StageName = 'Posted';
        Don4.Name = 'Single Donation 2';
        Don4.Amount = 25;
        Don4.CloseDate = System.today();
        Don4.Location__c = 'Town';
        Don4.Method_of_Payment__c = 'Cash';
        Don4.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don4;
        return Don4;
    }
    public Opportunity InsertSingleDonation3() {
        Account Acct = [SELECT Id FROM Account WHERE Name = 'Single Household'];
        Contact Cont = [SELECT Id FROM Contact WHERE FirstName = 'Jack'];
        Opportunity Don5 = new Opportunity();
        Don5.AccountId = Acct.Id;
        Don5.Contact__c = Cont.Id;
        Don5.StageName = 'Posted';
        Don5.Name = 'Single Donation 3';
        Don5.Amount = 45;
        Don5.CloseDate = System.today();
        Don5.Location__c = 'Town';
        Don5.Method_of_Payment__c = 'Cash';
        Don5.RecordTypeId ='0121N000000uGN8QAM';

        
        insert Don5;
        return Don5;
    }
}

 
Hello, i'm an admin who is rather inexperienced at Apex but this project was kind of dumped in my lap by a developer who has other positions he's filling right now, and I am in need of help since I can't find an answer to my particular problem. I am trying to test this query class and the test class keeps bringing the "attempt to de-reference a null object" error and I'm super confused. It's referring to line 6 in the test class so something with invoking the class is off, it seems but my lack of knowledge isn't particularly helping me figure out what I need to do. I'll leave the code for the class and test class below:
Class
public class AlroOrderBoMQuery {
	public Production_Tracking_Record__c custObj;
    public string HsgMat { get; set; }
    public string ECMat { get; set; }
    public string WPMat { get; set; }
    public string ThrtMat { get; set; }
    public string LnrMat { get; set; }
    
public AlroOrderBoMQuery(){
    }    
    
    public AlroOrderBoMQuery(ApexPages.StandardController controller){
        custObj=(Production_Tracking_Record__c)controller.getRecord();
        
           }
		Production_Tracking_Record__c ptr = [Select Id, Name, Product__c from Production_Tracking_Record__c where id =: custObj.Id limit 1];
    	
    	Product2 prod = [Select Id, Housing_Assembly__c, Drive_Endcap_Assembly__c, Tail_Endcap_Assembly__c, Housing_Material__c, Liner_Material__c, Endcap_Material__c, Wearplate__c, Housing_Throat_Plates__c from Product2 where id =: ptr.Product__c limit 1];
    	{
        HsgMat = prod.Housing_Material__c;
        ECMat = prod.Endcap_Material__c;
        WPMat = prod.Wearplate__c;
        ThrtMat = prod.Housing_Throat_Plates__c;
        LnrMat = prod.Liner_Material__c;
    	}
		List<Housing_Assembly_Attachment__c> HsgAsmAtt = [SELECT Quantity__c, Name, Id, Housing_Assembly__c FROM Housing_Assembly_Attachment__c WHERE Housing_Assembly__c =: prod.Housing_Assembly__c];
    	public List<Housing_Assembly_Attachment__c> getHsgAsmAtt() {
        return HsgAsmAtt;
    	   }
    	List<Endcap_Assembly_Attachment__c> DECAsmAtt = [SELECT Quantity__c, Name, Id, Endcap_Assembly__C FROM Endcap_Assembly_Attachment__c WHERE Endcap_Assembly__c =: prod.Drive_Endcap_Assembly__c];
    	public List<Endcap_Assembly_Attachment__c> getDECAsmAtt() {
        return DECAsmAtt;
    	   }
    	List<Endcap_Assembly_Attachment__c> TECAsmAtt = [SELECT Quantity__c, Name, Id, Endcap_Assembly__C FROM Endcap_Assembly_Attachment__c WHERE Endcap_Assembly__c =: prod.Tail_Endcap_Assembly__c];
    	public List<Endcap_Assembly_Attachment__c> getTECAsmAtt() {
        return TECAsmAtt;
    	}

    	
}

Test Class
@isTest
    private class TestAlroOrderBoMQuery {
        public static List<Opportunity> OpportunityList;
    
      static testMethod void TestAlroOrderBoMQuery() {
          AlroOrderBoMQuery BOM = new AlroOrderBoMQuery();

         
        Make__c make = new Make__c(Name='Kice');
        insert make;
        Model__c model = new Model__c(Name='Kice VJ 14x10x10',
                                     Make__c=make.Id,
                                     Product_Passage__c='Drop Thru');
        insert model;
        Housing_Assembly__c hsasm = new Housing_Assembly__c(Name='Kice Housing 1',
                                                            Model__c=model.Id,
                                                            Product_Passage__c='Drop-Through',
                                                            Housing_Type__c='Rebuild',
                                                            verified__c=true);
        insert hsasm;
        Housing_Assembly_Attachment__c hsasmatt = new Housing_Assembly_Attachment__c(Name='Drawing 1',
                                                                                    Housing_Assembly__c=hsasm.Id,
                                                                                    Quantity__c=1);
        insert hsasmatt;
        Attachment hsgatt = new Attachment(Name='Test Housing Attachment.jpg',
                                        ParentId=hsasmatt.Id,
                                        Body=Blob.valueOf('Test Housing Attachment'),
                                        IsPrivate=false);
        insert hsgatt;
        Endcap_Assembly__c ecasm = new Endcap_Assembly__c(Name='Kice Endcap 1',
                                                          Model__c=model.Id,
                                                          Endcap_Type__c='Rebuild',
                                                          Configuration__c='Inboard',
                                                          verified__c=true);
        insert ecasm;
        Endcap_Assembly_Attachment__c ecasmatt = new Endcap_Assembly_Attachment__c(Name='Drawing 2',
                                                                                    Endcap_Assembly__c=ecasm.Id,
                                                                                    Quantity__c=1);
        insert ecasmatt;
        Attachment ecatt = new Attachment(Name='Test Endcap Attachment.jpg',
                                        ParentId=hsasmatt.Id,
                                        Body=Blob.valueOf('Test Endcap Attachment'),
                                        IsPrivate=false);
        insert ecatt;
        Product2 prod = new Product2(Name='Test Product',
                                     Family='Kice',
                                     IsActive=true,
                                     Inboard_or_Outboard__c='Inboard',
                                     Rotor_Configuration__c='Open Fixed',
                                     Product_Passage__c='Drop Thru',
                                     Housing_Type__c='Rebuild',
                                     RecordTypeId='012G0000000qdfL',
                                     Make_Lookup__c=make.Id,
                                     Model_Lookup__c=model.Id,
                                     Housing_Assembly__c=hsasm.Id,
                                     Drive_Endcap_Assembly__c=ecasm.Id,
                                     Tail_Endcap_Assembly__c=ecasm.Id,
                                     Verified__c=true);
        insert prod;
        PricebookEntry PBE = new PricebookEntry(IsActive=true,
                                                UnitPrice=1000,
                                                UseStandardPrice=false,
                                                Pricebook2Id='01sG00000001zX0',
                                                Product2Id=prod.Id);
        insert PBE;
        Account acct = new Account(Name='Test Account',
                                   Type='Direct Customer',
                                   Shipping__c='Prepaid',
                                   Ship_Via__c='UTS',
                                   Sales_Discount__c=0);
        insert acct;
        Opportunity opp = new Opportunity(Name='12345',
                                          RA__c='12345',
                                          StageName='Quote Sent',
                                          CloseDate=System.today(),
                                          AccountId=acct.Id,
                                          Product__c=prod.Id,
                                          Make__c='Kice',
                                          Model__c='VJ 14x10x10',
                                          Max_Temp__c='120',
                                          Serial__c='N/A',
                                          Cold_Clr_Radial__c='.004-.007',
                                          Cold_Clr_Side__c='.004-.007');
        insert opp;
        Quote quote = new Quote(Name=opp.RA__c,
                                OpportunityId=opp.Id,
                                Pricebook2Id='01sG00000001zX0');
        insert quote;
        /*QuoteLineItem QLI = new QuoteLineItem(QuoteId=quote.Id,
                                              Product2Id=prod.Id,
                                              Quantity=1,
                                              PricebookEntryId=PBE.Id,
                                              UnitPrice=1000,
                                              Additional_Charges__c=0,
                                              Discounted_Amount__c=0,
                                              Core_Charge__c=0,
                                              Credit_Amount__c=0,
                                              Shipping_and_Handling__c=0,
                                              Rush_Charges__c=0);
        insert QLI; */
        
        
        Test.startTest();
        Production_Tracking_Record__c PTR = new Production_Tracking_Record__c(Name='12345',
                                                                              RA__c=opp.Id,
                                                                              Product__c=prod.Id,
                                                                              Housing_and_Endcaps_Order_Date__c=null,
                                                                              Shaft_Steps_on_Drive_End__c='1');
        insert PTR;
                  
        Test.stopTest();
        
        Production_Tracking_Record__c newptr = [ select id from Production_Tracking_Record__c where id =: BOM.custObj.Id];
        System.assertNotEquals('', BOM.custObj.Id, 'There is no ID');
        
        
    }
}
When I save there's not an error, but tests keep failing. If anyone could help, I'd greatly appreciate it!