Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Duplicate Check for any field
This code is compatible for coreBOS ?
No it isn't. It is for VT6, the validation code is very lacking and coreBOS has it's own system for validating records.

This is really easy to do in coreBOS, even to do it generically for all modules, I haven't had time to document the validation system but if you look at the modules/Accounts/AccountsValidation.php script you will see this exact example against the accountname. You can copy that script to any module, change the module name and adapt the query.

Once I document it I will share the link here.
I need the following

Create a custom field with an ID (unique number for payment of taxes of Brazilian companies)

If the account name (default) or this number already exists, give the standard treatment, or display duplicate the lead conversion, or add the contact to existing account.

Only I need, is, add a CF, in the standard treatment today is already coreBOS.

In script is only a treatment for default system fields, right?
Sorry, but I am not quite following you. These validation (currently) are only for form/field editing, not for actions (like lead conversion).
You can check for "anything" in the validation scripts, you could even go out to other systems if you needed to.

Please try to explain again if you can.
Ok, I got it.

What I need is right on lead conversion, add a custom field validation.

That is, if the account name or this field already exist the error "Account already exists ...
Understood now.

Thats code is for button save right?

There is two situations

One for lead convertion and another for save account.

And for second case, button save, how I can change SQL command to get a custom field, too ?
The easiest way to do that is using QueryGenerator:

PHP Code:
$queryGenerator = new QueryGenerator('Accounts'$current_user);
$query $queryGenerator->getQuery();
$rs $adb->query($query);
$cf_999 $adb->query_result($rs,0,'cf_999'); 

Look at our unit tests for a lot of examples:

Forum Jump:

Users browsing this thread: 1 Guest(s)