long entity names

Jan 2, 2013 at 4:22 PM
Edited Jan 2, 2013 at 4:24 PM

I've changed the code to the following to handle long entity names (in UIRecordCounter.Counter.$0)

old

if (!!$1_3)
{
	var $1_4 = Xrm.Page.ui.navigation.items.get($p0);
	$1_4.setLabel($1_4.getLabel() + ' (' + $1_3 + ')');
}
new

if (!!$1_3)
{
	var $1_4 = Xrm.Page.ui.navigation.items.get($p0);
	var $1_5 = $1_4.getLabel();

	if ($1_5.length >= (21 - $1_3.length))
	{
	        $1_5 = $1_5.substr(0, (21 - $1_3.length - 3)) + "...";
	}

	$1_4.setLabel($1_5 + ' (' + $1_3 + ')');
}
Coordinator
Jan 5, 2013 at 10:01 PM

Thanks David, I'll upload the script# source file shortly :)