Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Help Needed for "Close and Create new" Button

  1. #1
    swaroops1 is offline Senior Member
    Join Date
    Jul 2010
    Posts
    43

    Exclamation Help Needed for "Close and Create new" Button

    Dear Members,

    Its has been a great help by the answers provided in the forum to solve problem that poped up.

    But I was not able to find any solution for my present problem.

    I am restricting user only for Opportunity module. So in subpanel when they edit a call and click "Close and create new", after filling details when they click save, I need the user to come to opportunity Detail view page of that opportunity.

    I tried in editviewdef of Call module with the code below

    PHP Code:
           3 => 
              array (
                
    'customCode' => '{if $fields.status.value != "Held"}<input title="{$APP.LBL_CLOSE_AND_CREATE_BUTTON_TITLE}" accessKey="{$APP.LBL_CLOSE_AND_CREATE_BUTTON_KEY}" class="button" onclick="fill_invitees(); this.form.status.value=\'Held\'; this.form.action.value=\'Save\'; this.form.return_action.value=\'DetailView\'; {if isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true"}this.form.return_id.value=\'..\'; {/if}return check_form(\'EditView\') && isValidDuration();" type="submit" name="button" value="{$APP.LBL_CLOSE_AND_CREATE_BUTTON_LABEL}">{/if}',
              ), 
    But no use instead it goes to the detail view of the call that was created recently. Could somebody help me to redirect this to the opportunity that it is related to.

    And is there any way to clear the edit call when we click "close and create new" ?

    Thanks in advance.

  2. #2
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Help Needed for "Close and Create new" Button

    Hello,

    This is just a suggestion, you can use

    PHP Code:
    header("Location: URL"); exit; 
    in your after_save logic_hook. You have to put your condition for redirection.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  3. #3
    swaroops1 is offline Senior Member
    Join Date
    Jul 2010
    Posts
    43

    Exclamation Re: Help Needed for "Close and Create new" Button

    Thanks for the quick reply davidboris,

    How do I get the URL of that particular Opportunity ?

    Can anybody pls help in this regard ?

    If Just closing a call works then why can't "close and create new" redirect to the same detail view page..

    Thanks in Advance.

  4. #4
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Help Needed for "Close and Create new" Button

    Hi,

    You have parent_type & parent_id to redirect to detail view of an opportunity!
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  5. #5
    swaroops1 is offline Senior Member
    Join Date
    Jul 2010
    Posts
    43

    Exclamation Re: Help Needed for "Close and Create new" Button

    Hi,

    Thanks are the giving a hint.

    Will the code below work for the redirection back to the detail view where it came from ? ?

    PHP Code:
    header("Location: index.php?action=index&module=Opportunity"); 
    Thanks in Advance..

  6. #6
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Help Needed for "Close and Create new" Button

    Hello,

    PHP Code:
    header("Location: index.php?action=index&module=Opportunity"); 
    This will redirect to list view of opportunity.

    So you have to write something like

    PHP Code:
    header("Location: index.php?action=DetailView&module=Opportunity&record=".$ID_OF_OPP); 
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  7. #7
    swaroops1 is offline Senior Member
    Join Date
    Jul 2010
    Posts
    43

    Exclamation Re: Help Needed for "Close and Create new" Button

    Hi,

    Here is the logic hook I have created after_save in custom/modules/Calls
    PHP Code:
    <?php
    $hook_version 
    1;
    $hook_array = Array();

    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(
    0,
    'UpdateSalesStage',
    'custom/modules/Calls/UpdateSalesStage.php',
    'UpdateSalesStage',
    'UpdateSalesStage'
    );

    $hook_array['after_save'] = Array();
    $hook_array['after_save'][] = Array(
    0,
    'RedirectBack',
    'custom/modules/Calls/RedirectBack.php',
    'RedirectBack',
    'RedirectBack'
    );
    ?>
    This is the function created in custom/modules/Calls/RedirectBack.php

    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    require_once(
    'data/SugarBean.php');

    class 
    RedirectBack {

    function 
    RedirectBack(&$bean$event$arguments)
    {

    require_once(
    'modules/Opportunities/Opportunity.php');

    $bean->parent_id;
    header("Location: index.php?action=DetailView&module=Opportunity&record=".$bean->parentid);

    }
    }
    ?>
    After doing this my normal save button in Call EditView has a drop down which gets updated with opportunity is not working.

    Please help me to solve this problem..
    Last edited by swaroops1; 2010-08-26 at 11:09 AM. Reason: updation

  8. #8
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Help Needed for "Close and Create new" Button

    Hello,

    Try this one,

    PHP Code:

    header
    ("Location: index.php?action=DetailView&module=Opportunities&record=".$bean->parent_id);
    exit; 
    If it doesnt work, try echoing $bean.
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  9. #9
    swaroops1 is offline Senior Member
    Join Date
    Jul 2010
    Posts
    43

    Exclamation Re: Help Needed for "Close and Create new" Button

    Hi davidboris,

    The code is working great.
    The moment I click "Close and Create New" It redirects to the Opp Detail View instead of New Call Edit Page.

    My intention is to go to Detail Page of Opportunity when a Call is saved after creating that from "Close and Create New" button.

    Hope you understand my requirements..

    Thanks in Advance,

  10. #10
    swaroops1 is offline Senior Member
    Join Date
    Jul 2010
    Posts
    43

    Default Re: Help Needed for "Close and Create new" Button

    Hi Members,

    After examining closely I tried to solve this problem using

    strpos function to check the URL variable, but even that does not seem to work..

    Here is the code below for your reference.
    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    require_once(
    'data/SugarBean.php');

    class 
    RedirectBack {

    function 
    RedirectBack(&$bean$event$arguments)
    {
    echo 
    $event;
    require_once(
    'modules/Opportunities/Opportunity.php');
    $bean->parent_id;

    $check "Opportunity";
    if(
    strpos($_SERVER['REQUEST_URI'], $check) == FALSE) {
    header("Location: index.php?action=DetailView&module=Opportunities&record=".$bean->parent_id);
    exit;
    }
    exit;
    }
    }
    ?>
    Can anybody help to redirect back to Detail view after successfully creating a call using "Close and Create New".

    Any help would greatly be appreciated ! !

    Thanks in Advance.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 2009-12-23, 10:48 PM
  2. Replies: 1
    Last Post: 2009-07-01, 01:35 PM
  3. Replies: 2
    Last Post: 2009-04-09, 08:56 PM
  4. 50d-50h Upgrade Tasks "Close and Create New" not working
    By enablepay in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2008-09-23, 01:54 PM
  5. Replies: 1
    Last Post: 2008-03-08, 04:29 PM

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
  •