Attempting to add link field to custom module subpanel

I’ve created a custom module. I’m trying to add a link field to the subpanel that will open the records stored file.

In order to get the URL I’ve overloaded the retrieve method like this:

public function retrieve($id = -1, $encode = true, $deleted = true)
{
    $ret_val = parent::retrieve($id, $encode, $deleted);

    // We produce the $file_url_link field in code. It shouldn't get stored anywhere.
    $this->file_url_link = '<a href="' . $GLOBALS['sugar_config']['site_url'] . '/index.php?preview=yes&entryPoint=download&id=' . $id . '&type=' . $this->module_name . '">Open</a>';

    return $ret_val;
}

This works, and when I retrieve any record from the module I get the file_url_link field populated with the html code.

However, this only shows up properly in the detail view. I can’t figure out how to get it to display in the subpanel. It’s defined like this:

 'file_url_link' => array(
     'name' => 'file_url_link',
     'vname' => 'LBL_FILE_URL_LINK',
 ),

Does anyone have a clue for me? I feel like I’m missing something fairly obvious here. :\

I don’t know, but I’d try adding that 'source' => 'non-db' attribute and perhaps also a type

I’m not exactly sure why, but when I changed the field via a process_record logic hook, it worked. Apparently list-views (and hence subpanels) get their data from somewhere other than the bean’s ::retrieve method.

I’ve added this to the mystery pile and moved on.