Altering / Changing Multiline Text field width on Communication screen

By | March 26, 2012

The Administration section Sage CRM provides option not only to add new fields in an entity but also to change the entry type, Caption, Entry Width etc of the existing fields. Once altered these changes get reflected on the screen wherever used. But recently I came across a strange issue. The requirement was to change the width of the Details (comm_note) field in communication screen. As usual I changed the Entry width in the administration section for this field. But the changes were reflected only in the Edit mode and not in the View mode. The screen in Edit Mode:

In the view mode the details field was displayed as it was earlier. The width changes were not reflected. The screen in view mode:

By writing a script I was able to achieve the same width for the details field in both Edit and View mode.
1. Go to Administration-> Customization-> Communication -> Screen
2. Click on CustomCommunicationDetailBox.
3. In the comm_note field’s create script you need to add the below script:
//’Get act value from url
ActionVal=new String(Values(“Act”));
Caption=”Details:< input type=hidden Id=hdnact name=hdnact value='”+ActionVal+”‘ >”
Then in the custom content section include the below script:
< script for=window event=onload >
//’Change the width of the case details field
ChangeMultiline();
function ChangeMultiline()
{
//’Get the value of act from hidden variable
hdnact = new String(document.EntryForm.hdnact.value);
if(hdnact == ‘363’)
{
NoteHTML = document.getElementById(“_Datacomm_note”).innerHTML;
document.getElementById(“_Datacomm_note”).innerHTML = “< textarea CLASS=viewbox name=’comm_note’ readonly=true maxlength=0 rows=7 cols=100 >”+NoteHTML+”< /TEXTAREA >”;
}
}
< /script >