Logical hook for quick create form.

Hello, can any help me to add logic hooks on quick create form? Call module is subpanel of contacts and I need to add the logic hook on quick create the form to get login user id when we click the quick create button.

Please add a before/after save hook in the Calls Module. Hooks file should be place in Custom/Calls module and the hook manager class can be kept anywhere. Yet its class name and function reference should be there hook file.

Thanks

I already have hook file in calls module and its say we can not change that file. Can I make one more hook file there?

If you are talking about HOOK file, where hooks are defined. We can modify it and can add our own hook. Remember to change the file in custom folder.
And if you are talking about class file. Yes we can add and create as many files as we want.
Thanks

Hello, can you provide me solution for the logic hooks? I need a hook for quick create form and also for create-view. In these views, I have to fill the assigned to filed automatically before I save the form with the name. What are the best possible hook for me and one more thing calls module already have a logic hooks and in that file, code cannot be edited or we can not add anything.

logic_hooks.php file in calls module. so how i can edit or add our code in this file.

<?php // Do not store anything in this file that is not part of the array or the hook version. This file will // be automatically rebuilt in the future. $hook_version = 1; $hook_array = Array(); // position, file, function $hook_array['process_record'] = Array(); $hook_array['process_record'][] = Array(1, 'count', 'modules/Calls_Reschedule/reschedule_count.php','reschedule_count', 'count'); ?>

Hi,
if you want to fill in the assigned to field in the form view. Then hook is not a solution. You have to do some custom code using Ajax and Jquery.

Thanks

You can include your custom JS file/code in the Edit View and this will also work in the quick create page.
What are the conditions upon which you need to fetch the assigned user??

Thanks

With custom js, I did that but I need to implement this through a hook because js is taking time to load. because I am replacing the value from one user to another user. for a second old username is showing there and after that when js is loaded is changed with a fetched username.

Hook will not show the data in the FORM, hook is a backend code.
So hook can be used to save the data in backend but not to display it.

Custom JS is the only solution for display

ok, thanks once again. so custom js is only a way to do that.

Yes. Only this one.
This should not be slow. How you are doing that? Jquery + Ajax is best option. it can load data within miliseconds

I have implemented with Jquery+Ajax.

OK. Good

Hi,
I have a small issue in the suite CRM, I have implemented a logic hook ‘after_relationship_add’ everything is going well but only date_entered is going blank in the database. Don’t know why this thing happening. I also debugged the code at found the date_entered there but in the database the value is null. Can you please help me?

Hi,
Are you entering the date entered value as per MYSQL date format?
Did anything appears in the logs?

thanks

Yes, the date format is correct but still in the database, it inserted as a null value.

Can you share your query?

I mean your Hook code. So that i can check it
Thanks

Ok, let me share my code. I did not write the query just saving the call object which has date entered value.

<?php if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); class logic_hooks_class { function getCall($bean, $event, $arguments) { //echo '
'; print_r($arguments); 
            if($arguments['related_module'] == 'Calls' && $arguments['module'] = 'Contacts') {
                $call = $arguments['related_bean'];

                if(!empty($call->created_by)) {
                    $user_id = $call->created_by;
                    $date = $call->date_modified;
                }else{
                    $user_id = $bean->modified_user_id;
                    $date = $call->date_modified;
                }
                //echo'
'; print_r($call);  
                $call->assigned_user_id = $user_id;
                $call->date_entered = $date;
                echo $call->save(); 

            }
        }
    }

?>

Did you get my code?