• Jo Higgerson
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I have a trigger that works fine, it populates the fields it was designed to populate but when it run before insert it causes the id number to increment more than 1.  Below is my trigger code:
trigger ICNFill on BMCServiceDesk__Incident__c (before insert, before update) {
 List<BMCServiceDesk__Incident__c> ICNIncident = Trigger.new;
    
    String CircNo = ICNIncident[0].ICN_Circuit_No__c;
     if(String.isNotBlank(CircNo)) {
         
    Integer len;
        len = CircNo.length();
        if(len > 0) {
    
    List<BMCServiceDesk__BMC_BaseElement__c> ICNList = [Select ICN_Channel_No__c,
                                     ICN_Circuit_Status__c,
                                     ICN_Circuit_Type__c,
                                     ICN_Site_Business_Phone__c,
                                     ICN_Cell_Phone__c,
                                     ICN_Operation_Hours__c,
                                     ICN_Managed_By__c,
                                     ICN_Org_Name__c,
                                     ICN_Rate_Limit_Amount__c,
                                     ICN_Router_Interface__c,
                                     ICN_Router_Name__c,
                                     ICN_Site_Address__c,
                                     ICN_Site_City__c,
                                     ICN_Site_ID__c,
                                     ICN_Site_Name__c,
                                     ICN_Site_Phone__c,
                                     ICN_Site_Zip_Code__c,
                                     ICNZendRTC__c,
                                     ICNZendMSA__C,
                                     ICN_Parent_Circuit__c,
                                     ICNAendRTC__c,
                                     ICNAendMSA__c,
                                     ICN_Comments__c,
                                    ICN_First_Name__c,
                                     ICN_Last_Name__c,
                                      ICN_MLPP_MFR_VLAN_No__c                  
                                                        
             
                                     from BMCServiceDesk__BMC_BaseElement__c where ID = :CircNo];
   
   ICNIncident[0].ICN_Channel_No__c = ICNList[0].ICN_Channel_No__c;
   ICNIncident[0].ICN_Circuit_Status__c = ICNList[0].ICN_Circuit_Status__c;
   ICNIncident[0].ICN_Contact_Business_Phone__c = ICNList[0].ICN_Site_Business_Phone__c;
   ICNIncident[0].ICN_Contact_Cell_Phone__c = ICNList[0].ICN_Cell_Phone__c;

   ICNIncident[0].ICN_Managed_By__c = ICNList[0].ICN_Managed_By__c;
   ICNIncident[0].ICN_Org_Name__c = ICNList[0].ICN_Org_Name__c;

   ICNIncident[0].ICN_Rate_Limit_Amount__c = ICNList[0].ICN_Rate_Limit_Amount__c;
   ICNIncident[0].ICN_Router_Interface__c = ICNList[0].ICN_Router_Interface__c;
   ICNIncident[0].ICN_Router_Name__c = ICNList[0].ICN_Router_Name__c;
   ICNIncident[0].ICN_Site_Address1__c = ICNList[0].ICN_Site_Address__c;
   ICNIncident[0].ICN_Site_City__c = ICNList[0].ICN_Site_City__c;

   ICNIncident[0].ICN_Site_ID__c = ICNList[0].ICN_Site_ID__c;
   ICNIncident[0].ICN_Site_Name__c = ICNList[0].ICN_Site_Name__c;
   ICNIncident[0].ICN_Site_Phone__c = ICNList[0].ICN_Site_Phone__c;
   ICNIncident[0].ICN_Site_Zip_Code__c = ICNList[0].ICN_Site_Zip_Code__c;
   ICNIncident[0].ICNZendRTC__c = ICNList[0].ICNZendRTC__c;
   ICNIncident[0].ICNZendMSA__c = ICNList[0].ICNZendMSA__c;
   ICNIncident[0].ICNAendRTC__c = ICNList[0].ICNAendRTC__c;
   ICNIncident[0].ICNAendMSA__c = ICNList[0].ICNAendMSA__c;
   ICNIncident[0].ICN_Parent_Circuit__c = ICNList[0].ICN_Parent_Circuit__c;
   ICNIncident[0].ICNSite_Contact_First_Name__c = ICNList[0].ICN_First_Name__c;
   ICNIncident[0].ICNSite_Contact_Last_Name__c = ICNList[0].ICN_Last_Name__c;
   ICNIncident[0].ICN_Circuit_Type__c = ICNList[0].ICN_Circuit_Type__c;
   ICNIncident[0].ICNMLPP_MFR_VLAN_No__c = ICNList[0].ICN_MLPP_MFR_VLAN_No__c;
   ICNIncident[0].ICN_Comments__c = ICNList[0].ICN_Comments__c;
   
   }
   }
    
    
}

Any help would be greatly appreciated.  I'm new at this!!
This is my first test class and I'm not at all sure what I'm doing wrong, I get the error expecting a semi-colon, found '<EOF>' when trying to run this
 test class.  The code is as follows:
@isTest
public class ICNFILLTest {
    static testMethod void validateICN() {
        BMCServiceDesk__Incident__c b = new BMCServiceDesk__Incident__c(ICN_Circuit_No__c ='a0AM0000005KitpMAC');
 
       insert b;
       
    b.ICN_Circuit_No__c = '';
    update b;
    }
}

I tried to make it as simple as possible and I still get the error.  Any help would be greatly appreciated!
This is my first test class and I'm not at all sure what I'm doing wrong, I get the error expecting a semi-colon, found '<EOF>' when trying to run this
 test class.  The code is as follows:
@isTest
public class ICNFILLTest {
    static testMethod void validateICN() {
        BMCServiceDesk__Incident__c b = new BMCServiceDesk__Incident__c(ICN_Circuit_No__c ='a0AM0000005KitpMAC');
 
       insert b;
       
    b.ICN_Circuit_No__c = '';
    update b;
    }
}

I tried to make it as simple as possible and I still get the error.  Any help would be greatly appreciated!