Check duplication based on field condition in sugarcrm 7

Am checking duplicate check in Accounts module based on some filed condition.

In Account i have a dropdown field called Account Type with options as
1. Organisation

2. Individual

if i select Account Type == Organisation then i have to check duplicates for some specific fields field1,field2,field3,field4.

and

if i select Account Type == Individual then i have to check duplicates for fields field1,field2,field5,field6.

How this can be achieve in sugarcrm 7.7 version.

I found one article for Duplication check but i want conditional based duplication checkup

Can any one please help me out from this

Thanks in advance

Regards

Sam

Parents
  • Hi Sam,

    I am not sure but this may work:

    $dictionary['Account']['duplicate_check']['FilterDuplicateCheck'] = array(
        'filter_template' => array(
            array(
                '$or' => array(
                    array(
                        '$and' => array(
                            array('account_type' => array('$equals' => 'organisation')),
                            array('field1' => array('$equals' => '$field1')),
                            array('field2' => array('$equals' => '$field2')),
                            array('field3' => array('$equals' => '$field3')),
                            array('field4' => array('$equals' => '$field4')),
                        )
                    ),
                    array(
                        '$and' => array(
                            array('account_type' => array('$equals' => 'individual')),
                            array('field1' => array('$equals' => '$field1')),
                            array('field2' => array('$equals' => '$field2')),
                            array('field5' => array('$equals' => '$field5')),
                            array('field6' => array('$equals' => '$field6')),
                        )
                    )
                )
            ),
        )
    );
    
  • Hi David López

    Thanks for the reply, i will try and get back to you.

    Regards

    Sam

Reply Children
No Data