0

Whole of my code works perfectly, except for this part Inside of the for loop, where the system.debugs are, the system debugs don't leave any type of message on the debug log.

The "anorder.id" comes up with a number on a debug log but the orderIDSForZCustomerCreation doesn't get populated with that number. Does anyone know why this list wouldn't get populated ?

Thanks for any information.

List<Id> orderIDSForZCustomerCreation = new List<Id> ();
for(Order anOrder : Trigger.new){
    System.debug('Account ID of an account in iteration: ');
    System.debug(anOrder.AccountId);
    System.debug('Order Status set and anorder.status');
    System.debug(orderStatusSet);
    System.debug(anOrder.Status);
    System.debug('Is Trigger Update: ');
    System.debug(Trigger.isUpdate);
    System.debug('Old Map: ');
    System.debug(Trigger.oldMap.get(anOrder.id).Status);
    System.debug('Acc ID:');
    System.debug(eligibleAccounts.get(anOrder.AccountId));
    System.debug('Order ID: ');
    System.debug(anOrder.Id);

    if( Trigger.isUpdate && ( orderStatusSet.contains(anOrder.Status) ) 
        && ( orderStatusSet.contains(Trigger.oldMap.get(anOrder.id).Status) == false) ){
        if( null != eligibleAccounts.get(anOrder.AccountId) ){
            orderIDSForZCustomerCreation.add(anOrder.Id);
            System.debug('Size of orderIDS inside a loop');     
            System.debug(orderIDSForZCustomerCreation.size());
        }
    }
}        

System.debug(orderIDSForZCustomerCreation.isEmpty());
System.debug(orderIDSForZCustomerCreation);
if( !orderIDSForZCustomerCreation.isEmpty() ){
    // Call SF-Zuora Synch Processos
    System.debug('Its not empty'); 
    SFZSync_ZuoraCustomerSynchProcessor.processZCustomerAccountandSubscription(orderIDSForZCustomerCreation);
}

enter image description here

  • Are you getting debug stmt before 'if( null != eligibleAccounts.get(anOrder.AccountId) )' – Ysr Shk Jul 2 '18 at 13:40
  • yes, I've added all of the system debug statements that I worked with and they are all coming up with values except for the latter ones inside of the if statement. – Greg Jul 2 '18 at 13:56
  • So the line: System.debug(orderIDSForZCustomerCreation.size()); prints you a size > 0? – utm Jul 2 '18 at 14:03
  • 1
    So basically it looks like your if statement is never evaluating to true. Have you looked at your incoming data and carefully validated it against those conditions? orderStatusSet must contain the new value for Status and not the old value, and eligibleAccounts must contain the key anOrder.AccountId. – David Reed Jul 2 '18 at 14:08
  • 1
    Your debug log clearly shows that the order status is "In Progress" with old value null, and orderStatusSet contains only "Provisioning Queue". The if statement will be false. – David Reed Jul 2 '18 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.