Do not autocomplete data when creating new contact and select account

ood morning, to see if anyone can help me, I need to create a new contact in the CRM, and assign it to an account, do not autocomplete the phone and the address with the data that exist in the account to which it has been assigned . Any idea how to do it?

I’m sure there’s probably a better way, but I wound up switching the primary and alternate addresses because of precisely that feature - that way only the alternate address gets autocompleted. I suspect there’ll be wiser people than I along shortly to give you a better answer, but as a worst case scenario, this is one way of getting around it.

1 Like

Any Idea Please Any help me?

You need to create a logichook before save hook to change the values to “” on those fields.

LogicHooks docs here:
https://docs.suitecrm.com/developer/logic-hooks/

LogicHook Samples:
http://cheleguanaco.blogspot.com/2012/03/sugarcrm-cookbook-adding-related.html
https://stackoverflow.com/questions/41593367/how-to-create-a-logic-hook-in-sugarcrm-suitecrm-based-on-info-in-campaign-subp

I have not idea who can i change this values in a new logic-hooks, Can you send me a example for i learn it?

@bmatika
May be you can help this post: Related Field not work

I have tried to make this change so that I leave the office telephone field blank when I update the name of the account to which the contact belongs, but it does nothing, the phone is still updated with the account data automatically, Any idea what I can do?

<?php
class User_hook {
function copy(&$bean, $event, $argunments){
	if($bean->parent_type=='Contacts'){
		$bean = new contact();
		$bean->LBL_OFFICE_PHONE = " ";
		$bean->save();
		}
	}
}
?>

Remove this line

The $bean is already filled, it’s what you get from the function parameter, the current record being edited. You don’t need to create a new one, and if you do, whatever you put there has nothing to do with the current record.

You don’t explain which hook this is, is it before_save?

Yes i have this hook in before_save like here

$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array[‘before_save’] = Array();
$hook_array[‘before_save’][] = Array(1, ‘Contacts push feed’, ‘modules/Contacts/SugarFeeds/ContactFeed.php’,‘ContactFeed’, ‘pushFeed’);
$hook_array[‘before_save’][] = Array(77, ‘updateGeocodeInfo’, ‘modules/Contacts/ContactsJjwg_MapsLogicHook.php’,‘ContactsJjwg_MapsLogicHook’, ‘updateGeocodeInfo’);
$hook_array[‘before_save’][] = Array(2, ‘valores en blaco despues de account’, ‘custom/modules/contacts/actualizar.php’, ‘User_hook’, ‘copy’);

Do not work, When i update the account LBL_JOOMLA_ACCOUNT_ID automaticaly modify the LBL_OFFICE_PHONE for the office phone of the account and data of address too for the adress of the account.
How can i do so that you do not update anything in the contact form with the account information?

Remove this line also, you’re clearing out the entire hooks array :scream:

Exactly in which file are you saving that?

Then, you need to take it one step at a time. First thing is to ensure that your hook is running when you expect it to; and that you can read the bean (later we’ll see how to write to it). You can check this for example by logging some value from the Bean and then checking your logs.

I do not know who do i do it Can you help me?

This will log a message when the hook fires:

<?php
class User_hook {
function copy(&$bean, $event, $arguments){
     $GLOBALS['log']->fatal("Entering my hook");}
?>

Note that you have other basic PHP errors in your code. You’re not supposed to reference bean members (fields) by the label (LBL_etc).

I am afraid you seem completely lost with PHP, can’t you get a developer to help you? Or (better!) study PHP and learn more?