Results 1 to 7 of 7

Thread: Use of Permalinks for Cases

  1. #1
    Stratton is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    29

    Question Use of Permalinks for Cases

    Is there any way to create a permalink to Case records? For example, if I had a Case Number 500, is there anyway to link to this record using the case number instead of the ID?

    Thanks,
    Tony

  2. #2
    Stratton is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    29

    Default Re: Use of Permalinks for Cases

    Any ideas on this one, or is it even possible?

    Just to give an example, a current link to a Case #823 is like this:

    http://domain.com/sugarcrm/index.php?module=Cases&action=DetailView&record=87 59b24b-242c-fb40-5e00-49b6b1c78319

    But I'm looking for something like this:

    http://domain.com/sugarcrm/index.php?module=Cases&action=DetailView&record_nu mber=823


    Users are using another web interface to reference Case numbers, and they would like to link back to Sugar with the numbers, but we have no idea how to accomplish this.

    Thanks,
    Tony

  3. #3
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Use of Permalinks for Cases

    You could create your own action like CaseNumber and have it forward to the detail page. You'd then send to that action instead:

    http://domain.com/sugarcrm/index.php...ord_number=823

    And CaseNumber.php would do the id lookup and then forward internally to the DetailView with the id.

  4. #4
    Stratton is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    29

    Default Re: Use of Permalinks for Cases

    Thanks Jason, I see how this can work now. You wouldn't be able to point me in the direction of an example on how I could use the case_number to obtain the case_id would you?

  5. #5
    Stratton is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    29

    Default Re: Use of Permalinks for Cases

    I've been looking at the Case.php file, and have created a query (and I'm sure this question is asked/answered elsewhere), but I believe I'm missing something to make the connection to the database. Any suggestions there? I'll post if I find what I'm missing.

    Currently I have something like this in my CaseNumber.php:
    PHP Code:
    <?php
    $case_number 
    $_REQUEST['case_number'];
    $ret_array = array();
    $query "SELECT cases.id from cases where cases.case_number = '" $case_number "' and cases.deleted=0";

    $result $this->db->query($query,true," Error filling in additional detail fields: ");

    //Get the id
    $row $this->db->fetchByAssoc($result);

    if(
    $row != null){
          
    $ret_array['id'] = stripslashes($row['id']);
    }
    print_r($ret_array);
    ?>
    Thanks,
    Tony

  6. #6
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Use of Permalinks for Cases

    Tony,

    Another way to do it while avoiding SQL is to use get_list. This is code off the top of my head so it probably won't work as is:
    PHP Code:
    $case_number "123";
    require_once(
    'modules/Cases/Case.php');
    $case = new aCase();
    $list $case->get_list('id',"case_number=$case_number"');
    $id = $list['
    list][]->id

  7. #7
    Stratton is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    29

    Default Re: Use of Permalinks for Cases

    Well I couldn't figure it out using get_list, though I'd be curious to know how. But using your example, I was able to make what I started with work:

    PHP Code:
    $case_number $_REQUEST['case_number'];
    require_once(
    'modules/Cases/Case.php');
    $case = new aCase();
    $query "SELECT cases.id from cases where cases.case_number = '" $case_number "' and cases.deleted=0";
    $result $case->db->query($query,true," Error filling in additional detail fields: ");

    //Get the id
    $row $case->db->fetchByAssoc($result);
    $ret_array['id'] = stripslashes($row['id']);
    $record_id $ret_array['id'];
    $server_url $sugar_config['site_url'];
    //Redirect
    header 'Location:'.$server_url.'/index.php?module=Cases&action=DetailView&record='.$record_id.''); 
    Thanks again for your help,
    Tony

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cases view created cases
    By Wilkerson in forum General Discussion
    Replies: 0
    Last Post: 2008-11-12, 06:16 PM
  2. B2C use cases
    By manoj in forum Feature Requests
    Replies: 2
    Last Post: 2007-09-27, 10:09 AM
  3. Replies: 23
    Last Post: 2006-08-30, 05:32 PM
  4. Sub-cases
    By bpreston in forum Feature Requests
    Replies: 0
    Last Post: 2005-08-25, 03:28 PM
  5. Cases
    By whcanilang in forum Feature Requests
    Replies: 2
    Last Post: 2004-10-16, 08:21 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
  •