the 'customCode' dont work in dashletviewdefs.php / subpanel\<relationName>.php

Hello everyone
I want to make a complex url “http://localhost:8080/xxxxx-VF/contrat_crm/contrat_crm.php?cnt=83d1dedb-5d7b-d007-b1fb-552e93fb8ee1”, as a link in a word “Preview”, and when I try to use the ‘customCode’ in dashletviewdefs.php / subpanel<relationName>.php, nothing happen.

In studio , I created a field named : Preview

Hello,

For Listview & subpanel, You can achieve it via process_record logic hook.

I had already done, but it does not work

I created two files:

  • logic_hooks.php

-set_url.php

and content of the subpanel<ralationShipName>.php file is :

Hello,

As I said you need to use process_record logic hook.

sorry, I sent the wrong capture

This code works for the list view, and does not work for dashlet view and subpanel

can you share your set_url.php here?

I have already shared, in my 2nd post

recap :

  1. You have removed customCode for subpanel & listview right?
  2. You have that field in subpanel & listview correct?
  3. You don’t need to save bean in process record logic hook.

It should work.

So, if I understand:
1- I have to delete ‘custom code’ of the two files : listviewdefs.php and subpanel<relationShipName>.php
2- add the preview field in the subpanel and listview via Studio
3- remove the last line ’ $bean->save(); ’ in the set_url

to get this result

But in my case i get this result

Hello,

I got it. You need to write anchor tag in your logic hook!.

$bean->yourfield= “{$bean->whaever}”;

1 Like

Hi,

Why don’t you just create a URL type field instead.
With ‘Generate URL’, the system will build that for you without any logic hook and you will be able to display that field (hyperlink) i any kind of view.

Benoit

1 Like

I did it but how can i make a complex url “http://localhost:8080/xxxxx-VF/contrat_crm/contrat_crm.php?cnt=83d1dedb-5d7b-d007-b1fb-552e93fb8ee1”, as a link in a word “Preview” ?

Click generate url,
Enter http://localhost:8080/xxxxx-VF/contrat_crm/contrat_crm.php?cnt=
In default value,
Then add the id field

I did it ,but in the list view i get a full link, i dont want that the user view a full url

For the detail view, you can add
‘displayParams’ =>
array (
‘link_target’ => ‘_blank’,
‘title’ => ‘Preview’
),

it does not work for me
I must add this piece of code in the file listviewdefs.php ??

it does not work for me
I must add this piece of code in the file listviewdefs.php

That’s only for the details view.
For the list view, you will have to adapt that in PHP.
See, for example https://www.sugaroutfitters.com/blog/safely-customizing-a-core-bean-in-sugarcrm