Results 1 to 4 of 4

Thread: Workflows after save

  1. #1
    danweifis is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    20

    Default Workflows after save

    I found that all the workflows are before save, somebody knows how to create workflows after save?

    Thanks

    DAniel

  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: Workflows after save

    Hi Daniel

    The Alert work flow are all after_save.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    danweifis is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    20

    Default Re: Workflows after save

    here is the logic_hooks.php file generated.
    As you can see, the hook is registered for the 'before_save' event.

    <?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['before_save'] = Array();
    $hook_array['before_save'][] = Array(1, 'workflow', 'include/workflow/WorkFlowHandler.php','WorkFlowHandler', 'WorkFlowHandler');
    ?>

    Is there a way to change it via the GUI?

    Can sugar run a hook after an entity is saved only for newly created entities?

  4. #4
    wynn is offline Sugar Team Member
    Join Date
    Aug 2008
    Posts
    372

    Default Re: Workflows after save

    Yes, now workflow will only run before save, but there is logic hooks for 'after save'.

    you can refer to data/sugarbean.php, save method.
    there is

    $this->call_custom_logic("before_save", $custom_logic_arguments);

    and
    $this->call_custom_logic('after_save', '');

    workflow will be introduce by the first call_custom_logic.

    I think you can custom the workflow to make it run after save by yourself.


    But I'm wondering why you want to run the workflow after save?
    You can set a uid for a record before save method
    PHP Code:
    if(empty($focus->id)) {
        
    $focus->id create_guid();
        
    $focus->new_with_id true;

    Then you can use the related module information before save.

    But such as case_id cannot be get by this way.

    Quote Originally Posted by danweifis View Post
    here is the logic_hooks.php file generated.
    As you can see, the hook is registered for the 'before_save' event.

    <?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['before_save'] = Array();
    $hook_array['before_save'][] = Array(1, 'workflow', 'include/workflow/WorkFlowHandler.php','WorkFlowHandler', 'WorkFlowHandler');
    ?>

    Is there a way to change it via the GUI?

    Can sugar run a hook after an entity is saved only for newly created entities?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. customized workflows
    By ghadiyam in forum Developer Help
    Replies: 6
    Last Post: 2010-05-25, 09:06 AM
  2. Automated Workflows ???
    By Doodles in forum Help
    Replies: 3
    Last Post: 2007-04-05, 04:45 PM
  3. Automatisierte Workflows ???
    By Doodles in forum Deutsche
    Replies: 1
    Last Post: 2007-03-26, 11:58 AM
  4. Workflows
    By george_bbch in forum General Discussion
    Replies: 0
    Last Post: 2006-02-07, 09:02 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
  •