
well - first of all - you will get into trouble by putting the SOQL in the for loop of the Trigger.new. You should never do a SOQL in a loop. There is a limit of 100 SOQL's in any invocation. And a trigger can be called with up-to 200 records in the trigger.new list.But in this case - I think you should be able to just do one SOQL to get all of the details, and then as you're looping through those details, get the matching parent - and test the stage, then updating the detail stage number. More of something like this...
trigger loanStageNumberUpdate ON LLC_BI__Loan__c (after update) {
list<LLC_BI__Loan_Collateral2__c> Collaterals = new list<LLC_BI__Loan_Collateral2__c>([SELECT id,LLC_BI__Loan__c,Stage_Number__c FROM LLC_BI__Loan_Collateral2__c WHERE LLC_BI__Loan__c IN :trigger.newmap.keyset()]);
for(LLC_BI__Loan_Collateral2__c collateral :Collaterlas) {
if(trigger.newmap.containsKey(collateral.LLC_BI__Loan__c)) {
string stage = trigger.newmap.get(Acollateral.LLC_BI__Loan__c).LLC_BI__Stage__c;
if(stage == 'Pre-Underwriting') collateral.Stage_Number__c = 1;
if(stage == 'Underwriting') collateral.Stage_Number__c = 2;
if(stage == 'Credit Decision') collateral.Stage_Number__c = 3;
if(stage == 'Client Decision') collateral.Stage_Number__c = 4;
if(stage == 'Pre-Closing') collateral.Stage_Number__c = 5;
if(stage == 'Doc Prep') collateral.Stage_Number__c = 6;
if(stage == 'Doc Review') collateral.Stage_Number__c = 7;
if(stage == 'Post-Closing') collateral.Stage_Number__c = 8;
if(stage == 'Funding/Booking') collateral.Stage_Number__c = 9;
}
}
if(collaterals.size()>0) {
update collaterals;
}
}