Open Detail View From Custom Field in subpanel list View or a detail view button

Hi,

I have created a some custom module & linked them with relationship. I want to know how can i open detail view from subpanel if the name field is not in list view.

Can i make any other field to link to detail view or any button in subpanel along with edit button to open detail view.

Thanks for help

Singh

There is usually an edit or delete button in the last column of the subpanel row. if its not there then you can add via studio to the subpanel. Its also possible to use an process_record logic hook to add html for the a hyper link to any field in the subpanel and listview.

http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework/Logic_Hooks/02_Module_Hooks/process_record/

1 Like

Hi Andy

Thanks for your time, I am aware about the edit/delete button. My query is either I want to create a view button which shall open detail view of that record, or change a custom field in list view to act as main field which will open the detail view of record. Due to certain reason I don’t want name to appear in list view.
The subpanel is a custom module. And the name field is blank.

Use the process_record logic hook to add a link to any field you want that will open detail view of that record,

1 Like

Thank you for guiding me in right direction. I am an enthusiastic noob, I will search & learn about logic hooks & how to implement them in custom module.
Could you point me to some specific tutorial if there is any ?

If you google it there should be a few out there. Here is one :http://cheleguanaco.blogspot.co.uk/2009/06/simple-sugarcrm-logic-hook-example.html

1 Like

Hi Andy

Thanks for helping me out. I figured out some basics about logic hooks & how to create them. Tries with some examples & its working fine. But still I can’t figure out how to add link to detail view of same record through logic hook.

ie

function convertToProper(&$bean, $event, $arguments)
$bean->puncap = ucwords($bean->puncap);

Like this how can I code to add detail view link of same record

if you are using a process_record logic hook then in your function you would use something like:

$bean->puncap = ‘.$bean->puncap.’;

1 Like

Hi Andy

If i do like that in list view instead of field value it is appearing as $bean->puncap only & if i click on that it tales me to list.
If you see the attached screen shot, I dont want name field in list/subpanel so I want to open detail view from any other field.

My Logic_hooks

<?php $hook_version = 1; $hook_array = Array(); $hook_array['process_record'][] = Array(1, 'ProperTest', 'custom/modules/SGRND_RND/proper_test.php', 'ProperText', 'convertToProper'); ?>

My proper_test php

<?php /************************************* Project: Hook to Link a Field's to Detail View *************************************/ class ProperText { function convertToProper(&$bean, $event, $arguments) { $bean->puncap = '$.bean->puncap.'; } } ?>

Am I doing anything wrong

Sorry I am over estimating your knowledge of PHP… I really dont think you have programming skill level to make these kind of modifications :frowning:

The id should be the id of the record you want it to link to!



Try: $bean->puncap = '<a href="index.php?module=SGRND_RND&view=DetailView&record='.$bean->id.' ">'.$bean->puncap.'</a>';

also why have you $.bean->puncap instead of .$bean->puncap? The dots are very important they are for concatenating on the variables.

1 Like

The code above was slightly wrong I have edited and fixed it.

1 Like

Hi Andy

I had mentioned earlier I am noob, Not total noob but in web/php coding. But I am an IT guy & due to suitecrm want to learn about it now. I was looking for some CRM solutions & came to know about suite. I loved it from very first day & since then working on it. Hopefully I will get some hold of it in coming days. And thanks for your time & patience. Still there is an issue. Now the hyper-linked field points to first url while it should be second one. Instead of detail view it opens search view

http://127.0.0.1/index.php?module=SGRND_RND&view=DetailView&record=00000598-15f0-e7e1-21bc-54b5157cf3a5

http://127.0.0.1/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DSGRND_RND%26action%3DDetailView%26record%3D00000598-15f0-e7e1-21bc-54b5157cf3a5

I understand what’s going on, the id is wrong. It takes you to the search view because that id does not exist in the related module. You need to load the relationship in the logic hook and get the correct related id and use that to get create the link.

Firstly find the name of the relationship you created. You can see that in studio. Then post it here.

Also what is the name of the module you are running the logic hook on?

1 Like

Hi

The main module name is sgnpd_npd, the sub panel is sgrnd_rnd. The relationship name is sgnpd_npd_sgrnd_rnd (one to many)

Also to me id appears correct as both url pointing to “00000598-15f0-e7e1-21bc-54b5157cf3a5”.

Also just to clarify i am not trying to open detail view of related record, i am trying to open detail view of same record which is in subpanel. in this case sgrnd_rnd is subpanel of sgnpd_npd. I am creating a record in subpanel sgnpd_rnd & its saved & appear as list view in subpanel. If i keep name field in subpanel & click on that it opens the detail view of subpanel record as 2nd url in previous post. I want to replicate the same function with some other field.

Sorry my mistake it should be:


$bean->puncap = '<a href="index.php?module=SGRND_RND&action=DetailView&record='.$bean->id.' ">'.$bean->puncap.'</a>';

its not view= DetailView its action=DetailView.

1 Like

Thank you very much Andy it’s working as intended. :cheer:
I am grateful to you.