Credit Bureau Reporting - Metro 2 Format
The Metro 2 Format
Metro 2 is a data specification created by the Consumer Data Industry Association for credit reporting data furnishers (who are members of the credit bureau with a data furnishing service agreement) to report consumers' credit history information to major credit bureaus electronically and in a standardized format. It is the current standard format for reporting credit.
It meets all the requirements of the Fair Credit Reporting Act (FCRA), the Fair Credit Billing Act (FCBA), and the Equal Credit Opportunity Act (ECOA). It allows most accurate and complete information on consumers' credit history.
The Metro 2 Reporting in CL Loan
CL Loan provides reporting of basic segments via package and a framework that the customer can extend, to create a comprehensive report using appropriate custom hooks. This Metro2 Format report can be used for sharing borrower’s contract and other details with the credit reporting agencies. The report is generated on a monthly basis for all the current borrowers in the CL Loan system, either manually by the system administrator or by the scheduled M2FileGenerationJob job. This report is sent to the respective credit bureaus on their request.
The Metro 2 Format File
The Metro 2 file has the following sections:
Header section
Base section
Trailer section
A file has a header and a trailer section.
The Base section represents a loan. This section is divided into 9 segments, namely, Base, J1, J2, K1, K2, K3, K4, L1, and N1 segments. The segments are concatenated in one line for each loan account that is reported in the file.
You can see an example of such a file in the following image.
The marked reference numbers in the preceding image are named in the following table:
Reference Number | Name |
---|---|
1 | Header section |
2 | Base segment |
3 | Trailer section |
4 | The loan contract id |
5 | K1 segment |
Segments
A Metro2 file is made of the following segments:
Metro 2 Format - Header Record
The Header Record must be the first record provided and includes information necessary to identify the reporter.
Metro 2 Format - Base Segment
The Base segment is used to report the primary consumer’s identification information and the account transactional information.
Note:The Base Segment in the Metro2 file uniquely identifies a data furnisher. Data Furnishers are typically creditors, lenders or debt collection agencies that a consumer has had an experience or a past relationship with. This also contains the social security number of the customer. Therefore, once the Metro2 file is created and sent for credit reporting, the Base Segment records and the Metro2 file is deleted for data security purposes. This is done through the following schedulable batch jobs:
- DeleteBaseSegmentDefinition
- DeleteMetro2FilesUsers can also start these batch jobs manually if needed through the deleteBaseSegment Visualforce page. The page checks for any Metro2 base segments holding SSN information and displays an error message based on which a user can choose to trigger the batch apexs to delete those Metro2 base segments.
Metro 2 Format - J1 Segment
The J1 Segment is designed to accommodate the requirements of ECOA and applies when the associated consumer resides at the same address as the individual reported in the Base Segment. This segment must be present each time the account is reported.
Metro 2 Format - J2 Segment
The J2 Segment is designed to accommodate the requirements of ECOA and applies when the associated consumer resides at a different address than the individual reported in the Base Segment. This segment must be present each time the account is reported.
Metro 2 Format - K1 Segment
The K1 Segment must be present each time the account is reported by collection agencies, debt collectors, factoring companies, student loan guaranty agencies, and the U.S. Department of Education. The purpose of reporting the original creditor name is to help consumers identify the source of accounts when they appear on credit reports. Without the original creditor names, consumers may not know what the accounts represent.
Metro 2 Format - K2 Segment
The K2 Segment may be used to report the name of the company from which the portfolio or partial portfolio was purchased or the name of the company to which the portfolio or partial portfolio was sold. The K2 Segment should be reported only one time per record to affect the change.
Metro 2 Format - K3 Segment
The K3 Segment is used for the following two purposes:
To indicate a secondary marketing agency’s interest in a loan by providing the applicable account number as assigned by the secondary marketing agency.
To report the Mortgage Identification Number (MIN), when available.
This segment must be present each time the account is reported.
Metro 2 Format - K4 Segment
The K4 Segment can be used to report information on specialized payment schedules for either deferred payments or balloon payments. This segment must be present each time the account is reported if a deferred or balloon payment applies to the account.
Metro 2 Format - L1 Segment
The L1 Segment provides an automated method for changing the Consumer Account Number and/or Identification Number and should be reported only one time per record to affect the change. The L1 Segment contains the new Consumer Account Number and/or the new Identification Number and the Base Segment contains the old Consumer Account Number (Field 7) and/or old Identification Number (field 5) exactly as reported previously.
Metro 2 Format - N1 Segment
The N1 Segment may be used to report employment information for the consumer reported in the Base Segment.
Metro 2 Format - Trailer Record
The Trailer Record must be the last record provided on the file. It includes cumulative totals that are used to verify that all records received have been processed.
Generate a Metro 2 File
When you run the credit bureau reporting in CL Loan, you can generate a Metro 2 file to send to the credit bureau.
Steps
The following are the steps to generate a Metro 2 file in CL Loan to be sent to the credit bureau:
Step 1: Create the Metro2 parameters.
Step 3: Configure the Loan Contract.
Step 4: Generate the Metro2 Format File.
Step 1: Create the Metro 2 parameters
To create the Metro 2 parameters, perform the following steps:
Login to Salesforce account.
Go to Setup > Custom Settings > Metro2 Parameters.
Click Manage.
This displays the Metro2 Parameters with the details of the custom class as shown in the following image.
Click New.
Note:When you want to use the default settings, you can click Edit and edit the parameters as per the requirement. However, when you want to generate the Metro2 file for a specific customer, then you can click New.
In the Metro2 Parameters Edit window, specify the details as described in the following table, and then click Save.
Field Name Action Location This field is to identify if this setting is for org level or user level. This is a Salesforce standard field. Batch size for Metro2 job Specify the batch size for the Metro2 job. Batch size is the number of records that the Metro2 job will process at a time. Default is 200. Borrower Employment Info Class Specify the Borrower Employment Info class name. This is used to get the borrower information for the Metro2 file. This class must implement CRBorrowerEmploymentInfoInterface Interface. Borrower Info Class Specify the name of the Borrower Info class. This is used to get the borrower information for the Metro2 file. This class must implement CRBorrowerInfoInterface2 Interface. Creditor Classification Code Specify one of the following: - 01 Retail
- 02 Medical/Health Care
- 03 Oil Company
- 04 Government
- 05 Personal Services
- 06 Insurance
- 07 Educational
- 08 Banking
- 09 Rental/Leasing
- 10 Utilities
- 11 Cable/Cellular
- 12 Financial
- 13 Credit Union
- 14 Automotive
- 15 Check Guarantee
Equifax Identifier
Specify the unique identification number assigned by Equifax, a consumer reporting agency.
Experian Identifier
Specify the unique identification number assigned by Experian, a consumer reporting agency.
Folder Name
Specify the name of the folder where the Metro2 file will be generated.
Base Segment Identification Number
Specify the base segment identification number. This number is used to uniquely identify a data furnisher. Data furnishers are typically creditors, lenders, or debt collection agencies that a consumer has had an experience or a relationship with.
Innovis Identifier
Specify the Innovis identifier. This contains the unique identifier number assigned by Innovis, a consumer reporting agency.
Metro2 Query Class
Specify the Metro2 Query class name. This class is used to generate the query for the Contract and Account objects. This class must implement M2QueryGen Interface.
Microbilt PRBC Identifier
Specify the Microbilt PRBC Identifier. This contains the unique identification number assigned by PRBC, a consumer reporting agency.
Original Creditor Name
Specify the name of the Original Creditor.
Program Date
Specify the program date. This contains the date your reporting format was developed. The format is MMDDYYYY.
Program Revision Date
Specify the program revision date. This contains the last date your reporting format was revised. The format is MMDDYYYY.
Number of Records per File
Set this to a number which will determine the number of records taken by job for creating a Metro2 file. For example, 2000
Reporter Address
Specify the reporter address. This contains the complete mailing address of the processing company, i.e. the street address, city, state, and zip code.
Reporter Name
Specify the reporter name.
Reporter Phone
Specify the reporter phone. This contains the telephone number (area code + number) of the company that is sending the data ie. The data furnisher or the processor.
Transunion Identifier
Specify the transunion identifier. This contains the unique identification number assigned by TransUnion, a consumer reporting agency.
J1 Segment Generator Class
Specify the J1 segment generator class name. This field holds the class name to generate J1 segment. Enter Default to use default implementation.
J2 Segment Generator Class
Specify the J2 segment generator class name. This field holds the class name to generate J2 segment. Leave it blank if you do not want to generate this segment. Enter Default to use default implementation. To extend default implementation, provide class name that extends AbstractMetro2CustomGenerator.
K1 Segment Generator Class
Specify the K1 segment generator class name. This field holds the class name to generate K1 segment. Leave it blank if you do not want to generate this segment. Enter Default to use default implementation. To extend default implementation, provide class name that extends AbstractMetro2CustomGenerator.
K2 Segment Generator Class
Specify the K2 segment generator class name. This field holds the class name to generate K2 segment. Leave it blank if you do not want to generate this segment.
K3 Segment Generator Class
Specify the K3 segment generator class name. This field holds the class name to generate K3 segment. Leave it blank if you do not want to generate this segment.
K4 Segment Generator Class
Specify the K4 segment generator class name. This field holds the class name to generate K4 segment. Leave it blank if you do not want to generate this segment.
L1 Segment Generator Class
Specify the L1 segment generator class name. This field holds the class name to generate L1 segment. Leave it blank if you do not want to generate this segment.
N1 Segment Generator Class
Specify the N1 segment generator class name. This field holds the class name to generate N1 segment. Leave it blank if you do not want to generate this segment. Enter Default to use default implementation. To extend default implementation, provide class name that extends AbstractMetro2CustomGenerator.
Base Segment Generator Class
Specify the base segment generator class name. This field holds the class name to generate Base segment. This is a mandatory segment. So, if you leave it blank, it will still generate this segment. Enter Default to use default implementation. To extend default implementation, provide class name that extends AbstractMetro2CustomGenerator. Each base segment is for one loan.
Step 2: Upload the Format
Upload the Metro2 data format that is a CSV file using the data uploader. You can see a sample CSV file in the following link: CR Metro 2 Data Format.csv.
The target object for the data uploader is Cr_Metro_2_Data_Format__c.
Step 3: Configure the Loan Contract
While creating a contract, you can configure the loan contract for the credit bureau reporting. To know how to create a loan contract, refer to Create a simple loan contract.
The following image shows the credit bureau reporting section in a loan contract.
While creating the contract, under the Credit Bureau Reporting section, specify the details as mentioned in the following table.
Field Name | Action | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Include in Credit Reporting | Mark this flag true to include this section information in the credit reporting. After this flag is marked true, and if you do a disbursal, then all the fields in this section are included. | |||||||||||||||
Account Status Code | This is a system generated code for delinquency. | |||||||||||||||
Payment Rating | This is updated by the CreditBureauPaymentHistoryJob job which is run as part of SOD(Start Of the Day) job. The value of the current rating depends on the following conditions:
| |||||||||||||||
Payment History | This is updated by the CreditBureauPaymentHistoryJob job which is run as part of SOD(Start Of the Day) job. Payment History is used to report the history of payments. You can refer to the following table as an example on how the payment history gets generated.
|
Step 4: Generate the Metro2 Format File
Perform the following steps to generate the Metro2 Format file:
Login to Salesforce Account.
Click the + sign if you do not see the Metro2 tab.
Click Metro2.
Click the Metro2 file that needs to be generated.
Click Generate Metro2 File.
The job that generates the data for this file is run on the first of every month. It provides the status of the contract of the previous month.
Click the + sign if you do not see the Document tab.
Click Document.
Select the folder where the Metro2 file is stored.
Click Go!
The Metro file is generated.
Note:The Metro2 file is generated by the batch job called M2FileGenerationJob. The file creation is split into the following three parts:
- The Header section is created in the start method.
- The Trailer section in the finish method.
- The Base section and all other segments are created in the execute method.
- In the finish method, all the contents from header, base, and trailer are combined together and written into one large file.
Implementation of the Segments in CL Loan
In CL Loan, the object representation of the segments is first created. For every segment, from the header to the trailer, a record is created, and fields are populated that then get written in the file.
For the header section, the object, CR_Org_Definition__c, stores all the header information. Similarly, for all other segments, there are objects to store information of each segment.
For each of the segments except for a few, which the CL Loan does not support, there is an implementation class that extends AbstractMetro2CustomGenerator. The AbstractMetro2CustomGenerator is exposed globally so that users can implement any segment that they want in the file.
In CL Loan, the Metro 2 reporting functionality only creates the default segments for Base segments, K1 segments, N1 segments, and J2 segments in the system. For other segments, it sends the list of empty segments to the custom method.
When a loan is sold, or settled (between lender and borrower), the system creates the Metro2 file and then the Include In Credit Reporting field on the contract is deselected. The loan is considered equivalent to Closed Obligations Met from Metro2 reporting perspective. In future, the Metro2 file generation job does not pick up this contract.
While reporting written off loans, the Metro2 file indicates the current balance as per the charged off amount on the loan write off date.
Metro 2 Segment Customization
You can customize the segments of the Metro 2 as per the requirement.
Prerequisites
Following is the prerequisite to customize the segments of the Metro2 file:
Metro2 parameters are created.
Steps
Performing the following steps to customize the Metro2 parameters:
Login to Salesforce account.
Go to Setup > Custom Settings > Metro2 Parameters.
Click Manage.
This displays the Metro2 Parameters with the details of the custom class as shown in the following image.
Click Edit.
In the Metro2 Parameters Edit window, specify the custom class for the customization fields, and then click Save.
Customization Fields
Following are the fields used for this customization:
Base Segment Generator Class
J1 Segment Generator Class
J2 Segment Generator Class
K1 Segment Generator Class
K2 Segment Generator Class
K3 Segment Generator Class
K4 Segment Generator Class
L1 Segment Generator Class
N1 Segment Generator Class
Each preceding field stores the custom class name.
Usage of the Custom Class
Following are the key points for using custom classes in Metro2 reporting customization:
If the value of the preceding fields is Default, then it does not call any custom classes.
If the customization is required, then provide a name of the custom class for each segment in the preceding fields. If the name is provided as null, then that segment will not be generated. However, the segment will still be generated if a null is provided instead of the custom class name for Base Segment Generator class. If you want the segment to be generated, you need to either provide the custom class name or provide the value as Default.
In the custom class, the input arguments are loan account and the segment that was created by default in the CL Loan. So, it is not required to create an entire segment in the custom class, only the fields in the segment that need to be different than the default can be changed.
Custom class needs to extend the class AbstractMetro2CustomGenerator, and it has a method called createSegments which needs to be implemented.The following table gives the list of arguments that are passed in the custom class method createSegments.
Method: createSegments
Input parameter Type Description loanIdToLoanAccountMap
Map<Id, Loan_Account__c>
It is a map of loan account ids to loan account.
segmentsLoanAccountMap
Map<Id, List<SObject>>
It is a map of loan account id to segment that was created in the default CL Loan system.
For example, if it is a custom base segment class then it contains the base segments record that were created in the CL Loan system.
- Currently, it only creates the default segments for Base segments, K1 segments, N1 segments, and J2 segments in the system. For other segments, it sends the list of empty segments to the custom method.
- loanIdToLoanAccountMap contains all fields of loan account as given in Metro2 Query Class.
- You cannot change any values of loan account as they are overwritten by the job.
- You can only change loan__Include_In_Metro2_File__c field of Loan_Account__c by calling the method setIncludeInCreditReportingFlag(Id loanId, Boolean value). If the value in this method, is false, then Metro2 reporting is not done for this contract from that time on.
Sample Classes
The sample classes used for each segment are listed as follows:
Base Segment Generator Class
global class CustomBaseSegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanId : segmentsLoanAccountMap.keySet()){ List<Base_Segment_Definition__c> baseSegment = segmentsLoanAccountMap.get(loanId); for(Base_Segment_Definition__c base : baseSegment){ base.Portfolio_Type__c = 'A'; } setIncludeInCreditReportingFlag(loanId, false); } return segmentsLoanAccountMap; } }
K1 Segment Generator Class
global class CustomK1SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<K1_Segment__c> k1Segments = segmentsLoanAccountMap.get (loanAccount); for(K1_Segment__c k1 : k1Segments){ k1.Creditor_Classification__c = '0'+ k1.Creditor_Classification__c; } } return segmentsLoanAccountMap; } }
K2 Segment Generator Class
global class CustomK2SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<K2_Segment__c> segments = segmentsLoanAccountMap.get(loanAccount); if(segments.isEmpty()){ K2_Segment__c seg = new K2_Segment__c(); seg.Base_Segment_Definition__c = this.loanIdToBaseMap.get(loanAccount).Id; seg.Segment_Identifier__c = 'K2'; seg.Portfolio_Indicator__c = '2'; seg.Purchased_Portfolio__c = 'Ajay Devagan'; seg.Reserved__c = '0'; segments.add(seg); } } return segmentsLoanAccountMap; } }
K3 Segment Generator Class
global class CustomK3SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<K3_Segment__c> segments = segmentsLoanAccountMap.get (loanAccount); if(segments.isEmpty()){ K3_Segment__c seg = new K3_Segment__c(); seg.Base_Segment_Definition__c = this.loanIdToBaseMap.get (loanAccount).Id; seg.Segment_Identifier__c = 'K3'; seg.Agency_Identifier__c = '01'; seg.Account_Number__c = '123456789'; seg.Mortgafe_Identification_Number__c = '987654321'; segments.add(seg); } } return segmentsLoanAccountMap; } }
K4 Segment Generator Class
global class CustomK4SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ //query borrower account Set<Id> loanIds = new Set<Id>(); for(Id loanAccount : segmentsLoanAccountMap.keySet()){ loanIds.add(loanAccount); } //Query borrower ids from contracts Map<Id, Loan_Account__c> loans = new Map<Id, Loan_Account__c> ([SELECT Id, First_Installment_Date__c FROM Loan_Account__c WHERE Id IN:loanIds]); for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<K4_Segment__c> segments = segmentsLoanAccountMap.get (loanAccount); if(segments.isEmpty()){ K4_Segment__c seg = new K4_Segment__c(); seg.Base_Segment_Definition__c = this.loanIdToBaseMap.get (loanAccount).Id; seg.Segment_Identifier__c = 'K4'; seg.Specialized_Payment_Indicator__c = '02'; seg.Deffered_Payment_Start_Date__c = loans.get (loanAccount).First_Installment_Date__c; segments.add(seg); } } return segmentsLoanAccountMap; } }
L1 Segment Generator Class
global class CustomL1SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ //query borrower account Set<Id> loanIds = new Set<Id>(); Set<Id> borrowerIds = new Set<Id>(); for(Id loanAccount : segmentsLoanAccountMap.keySet()){ loanIds.add(loanAccount); } //Query borrower ids from contracts Map<Id, Loan_Account__c> loans = new Map<Id, Loan_Account__c> ([SELECT Id, Contact__r.Name FROM Loan_Account__c WHERE Id IN:loanIds]); for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<L1_Segment__c> segments = segmentsLoanAccountMap.get (loanAccount); if(segments.isEmpty()){ L1_Segment__c seg = new L1_Segment__c(); seg.Base_Segment_Definition__c = this.loanIdToBaseMap. get(loanAccount).Id; seg.Segment_Identifier__c = 'L1'; seg.Change_Indicator__c = '1'; seg.New_Consumer_Account_Number__c = loans.get (loanAccount).Contact__r.Name; segments.add(seg); } } return segmentsLoanAccountMap; } }
J1 Segment Generator Class
global class CustomJ1SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ //query borrower account Set<Id> loanIds = new Set<Id>(); Set<Id> borrowerIds = new Set<Id>(); for(Id loanAccount : segmentsLoanAccountMap.keySet()){ loanIds.add(loanAccount); } //Query borrower ids from contracts Map<Id, Loan_Account__c> loans = new Map<Id, Loan_Account__c> ([SELECT Id, Contact__r.ints__Social_Security_Number__c FROM Loan_Account__c WHERE Id IN:loanIds]); for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<J1_Segment__c> j1Segments = segmentsLoanAccountMap.get(loanAccount); if(j1Segments.isEmpty()){ J1_Segment__c j1 = new J1_Segment__c(); j1.Base_Segment_Definition__c = this.loanIdToBaseMap.get(loanAccount).Id; j1.Segment_Identifier__c = 'J1'; j1.Consumber_Information_Indicator__c = '5'; j1.Social_Security_Number__c = loans.get (loanAccount).Contact__r.ints__Social_Security_Number__c; j1Segments.add(j1); } } return segmentsLoanAccountMap; } }
J2 Segment Generator Class
global class CustomJ2SegmentGenerator2 extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments (Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<J2_Segment__c> j2Segments = segmentsLoanAccountMap.get (loanAccount); for(J2_Segment__c j2 : j2Segments){ if(j2.First_Name__c == 'James'){ j2.Social_Security_Number__c = '12344'; } else if(j2.First_Name__c == 'Sherlock'){ j2.Social_Security_Number__c = '54321'; } } setIncludeInCreditReportingFlag(loanAccount, false); } return segmentsLoanAccountMap; } }
N1 Segment Generator Class
global class CustomN1SegmentGenerator extends AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanAccount : segmentsLoanAccountMap.keySet()){ List<N1_Segment__c> n1Segments = segmentsLoanAccountMap.get (loanAccount); for(N1_Segment__c n1 : n1Segments){ n1.Employer_Name__c = 'Employer Name Changed'; } } return segmentsLoanAccountMap; } }
Customizing the Segment Values in a Metro2 File
If you want to change any of the fields reported in Metro 2 but you do not want to change it manually for every Metro 2 file, then you can extend loan.AbstractMetro2CustomGenerator class and override the method createSegments. This makes M2FileGenerationJob run the implementation, and you can see the changes in committed records of M2FileGenerationJob and also in the file.
In order for this to work, you need to register class names in Metro2 Parameters custom setting. See Steps to customize the segments.
Example
Say, you need to change Portfolio Type of base segment for a particular loan. As you are creating custom class for base segment, you need to specify the class name in Base Segment Generator Class field of Metro2 Parameters.
global class CustomBaseSegmentGenerator extends loan.AbstractMetro2CustomGenerator { global override Map<Id, List<SObject>> createSegments(Map<Id, loan__Loan_Account__c> loanIdToLoanAccountMap, Map<Id, List<SObject>> segmentsLoanAccountMap){ for(Id loanId : segmentsLoanAccountMap.keySet()){ loan__Base_Segment_Definition__c baseSegment = segmentsLoanAccountMap.get(loanId).get(0); loan__Loan_Account__c loanAccount = loanIdToLoanAccountMap.get(loanId); if(loanAccount.Product_Type__c == 'LOC'){ baseSegment.loan__Portfolio_Type__c = 'A'; } /* If you want to stop reporting for this loan account from now on, call setIncludeInCreditReportingFlag method from super class. This will update loan__Include_In_Metro2_File__c of loan account. */ if(loanAccount.loan__Loan_Status__c == loan.LoanConstants.LOAN_STATUS_CLOSED_WRITTEN_OFF){ setIncludeInCreditReportingFlag(loanId, false); } } return segmentsLoanAccountMap; } }
You need to create separate class for every type of segment you need to modify.
You can create only one implementation per segment. All changes should be done in that implementation.
loanIdToLoanAccountMap contains all fields of loan account as given in Metro2 Query Class
You cannot change any values of loan account as they will get overwritten by the job.
At time of this writing this class, you can change loan__Include_In_Metro2_File__c by calling setIncludeInCreditReportingFlag only.