Adding fields to application object
Upon upgrading to Q2 Origination 2.2003 or later, you must add the following two fields to the Application object:
- Total Fee Amount- this field stores the sum of fee amounts from all the fee records associated with an application.
- Total Pledged Collateral Amount- this field stores the sum of all the pledged collateral amounts associated with an application. This is used by the collateral dashboard.
Note:
For existing customers, these values will be Null. You can execute a script to add these fields to the object, as described in the steps below.
Prerequisites
Before you proceed to add the fields to the Application object, ensure that the following prerequisite is met:
You have upgraded from a Q2 Origination version earlier than 2.2003.
Steps
To add the fields to the Application object:
Log in to your Salesforce account.
Select your profile name on the top right of the page, and select Developer Console.
Select Debug > Open Execute Anonymous Window.
-
Paste the following code, and select Execute:
CodeCopyList<genesis__Applications__c> applicationList = [SELECT Name,Id, genesis__Total_Fee_Amount__c, genesis__Total_Pledged_Collateral_Amount__c, (SELECT clcommon__Original_Amount__c FROM genesis__Fees__r), (SELECT genesis__Pledge_Amount__c FROM genesis__Application_Collaterals__r) FROM genesis__Applications__c];
for(genesis__Applications__c app : applicationList){
app.genesis__Total_Fee_Amount__c = 0;
for(clcommon__Fee__c fee : app.genesis__Fees__r){
app.genesis__Total_Fee_Amount__c = app.genesis__Total_Fee_Amount__c + fee.clcommon__Original_Amount__c;
}
app.genesis__Total_Pledged_Collateral_Amount__c = 0;
for(genesis__Application_Collateral__c col : app.genesis__Application_Collaterals__r){ app.genesis__Total_Pledged_Collateral_Amount__c = app.genesis__Total_Pledged_Collateral_Amount__c + col.genesis__Pledge_Amount__c;
}
}
update applicationList;