function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chuck HarveyChuck Harvey 

Problem creating a class when inserting a new record

I have a custom object I created called Customer Fact Sheet.  When I save in the Customer Fact Sheet, I want a new record to create in the Status Report object with the Status_Unique_ID the same as what is in CUstomer Fact Sheet.  I am trying to create a class that will create a new record and pass the Status Unique ID.  The Error I am getting is Status Unique ID column is not in the Status Report object.  I cannot figure out why because I am copying the API name from the Status Report object so it should be a match.  After I get these solved, I would like to see there is no duplicate before I insert.

@isTest
public class StatusID {
  static testmethod void insertID() {
   List<Customer_Fact_Sheet__c> result = [SELECT Status_Unique_ID__c  FROM Customer_Fact_Sheet__c
                WHERE Status_Unique_ID__c = :ApexPages.currentPage().getParameters().get(' Status_Unique_ID__c')];
 {       if (result.size() > 0) 
        Status_Report__c IStatus = new Status_Report__c();
        IStatus.Status_Unique_ID__c = result[0].Status_Unique_ID__c;
        insert IStatus;
         }     
     }
 }
Error: Compile Error: Variable does not exist:IStatus:Status_Unique_ID__c at line 8 column 9
SonamSonam (Salesforce Developers) 
From the following:
  List<Customer_Fact_Sheet__c> result = [SELECT Status_Unique_ID__c  FROM Customer_Fact_Sheet__c I understand that the field Status_Unique_ID__c is in Object : Customer_Fact_Sheet__c

Do you have the same field with the same name in Status_Report__c object? If not, please replace  it with the correct name in line:
 IStatus.Status_Unique_ID__c = result[0].Status_Unique_ID__c;
Chuck HarveyChuck Harvey
The Status_Unique_Id in Customer_Fact_Sheet__c is the same in Status_Report__c.  That is what is difficult because the name are the same. 
Thanks