0

I am writing a piece of code in a trigger which gives correct results. it is not working quite well. It is working for either one scenario.

if ( (CV1 == Ol)) {
    System.debug('Enter 1 :');
    if ((po.Type__c == o.Product_Interest__c)) {
        System.debug('Enter 2 :');
        if ((po.Agent_City__c == o.Contact_City__c)) {
            System.debug('Enter 3 :');
            if ((m.name == po.Covered_Person1_First_Name__c)) {
                System.debug('Enter 4 :');  //either this
                if (m.name == o.Opp_First_Name__c) { // or this one is working not both
                    System.debug('Enter 5 :');
                    o.Policy__c = po.id;
                }
            }
        }
    }
}

Here either 'Enter 4' statement is working or 'enter 5' if condition statement is working. When i alternatively removed and tested. But not working with both.

1
  • Can you clarify which conditions you want to work together? There are 5 open braces and only 3 are closed.
    – Ashwani
    Commented Jun 24, 2015 at 8:57

1 Answer 1

1

Both will be printed if and only if your

po.Covered_Person1_First_Name__c == o.Opp_First_Name__c

check whether they are same or not. You can test that out using "Hard coded" value first.

2
  • Those were not equal but the value m.name from one of value should be equal with both names. m.name value coming from custom setttings Commented Jun 24, 2015 at 11:02
  • @ChinChunChang, could you post what values are you are getting for them?
    – sIQh
    Commented Jun 29, 2015 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .