Adding additional info to Additional Details popup of Accounts

Hi,

After the whole migration of Accounts and Notes from previous system to SuiteCRM, our sales people forwards a request about adding some more information to popup.

We have already customized List View of Accounts but we do not want to make it with so many columns.

I see that I can customize the content of Additional Details popup with ADDTIONAL DETAILS

Can I show the most recent Note about the account to be displayed in that Additional Details popup ? how?

Thanks in advance.

Okan.

To be honest I never tried actually doing it, but following that link you gave to my older post, since that is a PHP file, you should be ok running some PHP code to grab the Bean of a related record.

You just need to check what you get inside that $fields parameter, if that is enough to query for the right Beans.

If you’re not familiar with Beans, read this

I think you can do it by custom code like @pgr has mentioned. You can modify the file additionalDetails file. If you know coding this is easy for you. If you don’t now coding, you can engage any developer for this.
Thanks

Hi all,

I have added following to get notes belong to an account. I think there should be a better way to get only the most recent one with a query but I could not manage it.

This one at least works but with getting all the notes of an Account. I wonder if this slow down opening the Additional Information popup if the number of notes increase to hundreds for an Account.

    $notesBean = BeanFactory::getBean('Notes');

   	$orderForNotes = 'date_modified desc';
 	$where_clause = 'parent_type = \'Accounts\' and parent_id = \'' . $fields['ID'] .'\'';

	$notesArray = array();
	$notesArray = $notesBean->get_full_list($orderForNotes, $where_clause);
	if (!empty($notesArray))
	{
		$lastNote = $notesArray[0];

		$overlib_string .= '<br>';
		$overlib_string .= '<b>Subject of Last Note: </b>' . $lastNote->name;
		$overlib_string .= '<br>';
		$overlib_string .= '<b>Last Note: </b>' . $lastNote->description;
	}

Any ideas for how to get only the most recent Note row instead of all Notes of an account ?

Thanks

Maybe you would be better off with a direct SQL query to get only the newest record and avoid the performance penalty.

Thanks Pedro,

After some digging to find how to perform direct/raw SQL, I have achieved following visual with timing comparison. I have tested with the Account which has the most number of Notes ( 185 Notes after migration ) in whole 106K notes. Comparison is not fair but raw SQL with fetchOne performs much better as expected.

I have also made decorations with $mod _strings for multiple languages.

I’m sharing as a reference for others for simply retrieving data from DB, not so difficult.

$orderForNotes = 'date_modified desc';
$where_clause = 'parent_type = \'Accounts\' and parent_id = \'' . $fields['ID'] .'\'';

$start = microtime(TRUE);
$notesBean = BeanFactory::getBean('Notes');
	
$notesArray = array();
$notesArray = $notesBean->get_full_list($orderForNotes, $where_clause);
if (!empty($notesArray))
{
	$lastNote = $notesArray[0];

	$overlib_string .= '<br>';
	$overlib_string .= '<b>' . $mod_strings['LBL_ACCOUNT_ADDITIONAL_INFO_SUBJECT_OFLASTNOTE'] . ': </b>' . $lastNote->name;
	$overlib_string .= '<br>';
	$overlib_string .= '<b>' . $mod_strings['LBL_ACCOUNT_ADDITIONAL_INFO_LASTNOTE_OFLASTNOTE'] . ' (' . $lastNote->date_modified . '): </b>' . $lastNote->description;
}
$end = microtime(TRUE);
$overlib_string .= '<br> Duration with bean&get_full_list is : ' . ($end - $start) . ' seconds ';

$start = microtime(TRUE);
$sql = 'Select name, description, date_modified from notes ' . 
	   'Where id = ( SELECT id from notes where ' .
	   $where_clause .
	   ' order by date_modified DESC LIMIT 1 ) ';
		  
$resultRow = $GLOBALS['db']->fetchOne($sql);
	
if(!empty($resultRow))
{
	$overlib_string .= '<br>';
	$overlib_string .= '<b>' . $mod_strings['LBL_ACCOUNT_ADDITIONAL_INFO_SUBJECT_OFLASTNOTE'] . ': </b>' . $resultRow['name'];
	$overlib_string .= '<br>';
	$overlib_string .= '<b>' . $mod_strings['LBL_ACCOUNT_ADDITIONAL_INFO_LASTNOTE_OFLASTNOTE'] . ' (' . $resultRow['date_modified'] . '): </b>' . $resultRow['description'];
}
$end = microtime(TRUE);
$overlib_string .= '<br> Duration raw SQL is : ' . ($end - $start) . ' seconds ';

Here the visual:

1 Like