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
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
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
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.
Co-Founder of: SugarOutfitters
Modules:
SecuritySuite (Teams)
Photo Module
Follow me on Twitter:eggsurplus
Your Personal Developer
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?
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:
Thanks,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);
?>
Tony
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;
Co-Founder of: SugarOutfitters
Modules:
SecuritySuite (Teams)
Photo Module
Follow me on Twitter:eggsurplus
Your Personal Developer
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:
Thanks again for your help,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.'');
Tony
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks