Amol Bansode
Amol Bansode

Reputation: 365

How to send email notification after creating lead in sugarcrm through webservice(nusoap)

I have successfully created a lead in sugarcrm 6.5 using nusoap. But now problem is, How to send email notification to assigned user?

Please help me!!

Upvotes: 1

Views: 3682

Answers (2)

compsmart
compsmart

Reputation: 161

If you have the process manager available in your Sugar Version (entrprise+) then you just have to create a process definition that triggers an email when a new lead is created. If not then it's a logic hook.

Upvotes: 0

Chad Hutchins
Chad Hutchins

Reputation: 484

Based on your situation, what I would do is use a after_save logic hook to send your email. Logic Hooks allow you to plug into the SugarCRM logic. The code below allows you to do something after a Lead is saved.

Create a logic_hooks.php or add the following if it already exists in custom/modules/Leads/logic_hooks.php

<?php

$hook_version = 1; 
$hook_array = Array(); 
$hook_array['after_save'] = Array(); 
$hook_array['after_save'][] = Array(1, 'Send Notification', 'custom/modules/Leads/Leads_custom.php','Leads_custom', 'send_notification'); 

After any Lead is saved, it'll run the following code in custom/modules/Leads/Leads_custom.php

<?php

class Leads_custom
{
    function send_notification($bean, $event, $arguments)
    {
        // write your code here to send the notification to the head(Manager)
    }
}

This will fire anytime Leads are created or edited. If you need to only send notifications on new Leads, you can use this technique: http://developers.sugarcrm.com/wordpress/2013/08/21/doing-beforeafter-field-comparisons-in-after_save-logic-hooks/

Upvotes: 2

Related Questions