Results 1 to 5 of 5

Thread: automatically create a task when a lead status is changed

  1. #1
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default automatically create a task when a lead status is changed

    Hello everyone,

    O/S:Windows 2000
    SugarCRM community edition
    Version 5.0.0b (Build 3150) (upgraded from Version 5.0.0a (Build 3150))


    I have added a date field follow-up-date in leads module.
    I have also made the label of lead status Dead to "Close".

    So when a lead status is changed to Close i want to create a new task with due date as follow-up-date.

    I am trying to find out,please help me.
    Its really urgent.

    Your help will be really very much appericiable.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: automatically create a task when a lead status is changed

    HI, sawan.

    I just answered this question into your other post.

    Cheers


    --
    André Lopes
    Lâmpada Global Services
    Rua Bela Cintra, 299 conjunto. 51
    São Paulo, SP 01415-000
    tel1. 55 11 3237-3110
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  3. #3
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: automatically create a task when a lead status is changed

    Hey thanks Andopes ,yes it should be in quotes,my mistake.
    i am working further on logic right now.
    Thanks again.

  4. #4
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: automatically create a task when a lead status is changed

    Now i have to write the logic of insert new task.that is fine.but the problem is,each task has an unique id field which is generated by sugarcrm.i think createguid function does that.but while creating a new task(i.e. inserting new task in db) in normal manner i.e. create task in sugarcrm is having some definate flow.i can insert all other field values except this id field ,how can i achieve this?
    please guide.
    thanks

  5. #5
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: automatically create a task when a lead status is changed

    Hello every one,

    i have found the solution.
    i got help from some threads:

    http://www.sugarcrm.com/forums/showthread.php?t=30315
    http://www.sugarcrm.com/forums/showthread.php?t=28400

    thanks to these people.

    here is the code

    <?php
    require_once('include/utils.php');

    class TestClass{

    function lead_before_save_1(&$bean, $event, $arguments)
    {

    if($event == 'before_save' && $bean->status == 'Dead')
    {
    $guid = create_guid();
    $leadname2='Call lead '.$bean->first_name.$bean->last_name;

    $query="insert into Tasks(id,name,modified_user_id ,created_by,assigned_user_id,status,date_due,paren t_type,parent_id,priority)values('$guid','$leadnam e2','1','1','1','In Progress','$bean->followupdate_c','Leads','$bean->id','High')";

    $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

    }

    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. workflow to change lead status
    By graatz in forum Help
    Replies: 3
    Last Post: 2008-01-16, 05:08 PM
  2. From lead to order
    By george_bbch in forum Feature Requests
    Replies: 0
    Last Post: 2006-09-26, 02:02 PM
  3. HTTPUnit Create Lead...
    By rje in forum Developer Help
    Replies: 0
    Last Post: 2005-12-20, 04:12 PM
  4. Replies: 0
    Last Post: 2005-09-24, 10:27 PM
  5. Enable the status in the Task List
    By km in forum Feature Requests
    Replies: 1
    Last Post: 2004-11-05, 04:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •