How do I hide the 'Follow-up' check boxes on a New Appointment or New Task Screen Screen?

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

How do I hide the 'Follow-up' check boxes on a New Appointment or New Task Screen Screen?

  • Comments 1
  • Likes

Below is a screen shot that shows the New Task Screen.  You'll see there are some checkboxes that if selected will launch another new communication screen once the New Communication is saved.

The HTML that generates these Checkboxes looks like this:


<TABLE CLASS=VIEWBOXCAPTION><TR><TD><TD><input type=checkbox name=DoFollowUpTask value="Y" onclick="javascript:if (checked) document.forms[0].DoFollowUpAppt.checked=!checked;"></TD><TD><div style="cursor:hand" onclick="javascript:document.forms[0].DoFollowUpTask.click();">Create Follow-up Task</div></TD></TR><input type=hidden name=_HIDDENDoFollowUpTask value=""></TABLE><TABLE CLASS=VIEWBOXCAPTION><TR><TD><TD><input type=checkbox name=DoFollowUpAppt value="Y" onclick="javascript:if (checked) document.forms[0].DoFollowUpTask.checked=!checked;"></TD><TD><div style="cursor:hand" onclick="javascript:document.forms[0].DoFollowUpAppt.click();">Create Follow-up Appointment</div></TD></TR><input type=hidden name=_HIDDENDoFollowUpAppt value=""></TABLE>
 

We can see that the fields are called

  • DoFollowUpTask
  • DoFollowUpAppt

The Checkbox fields are not defined in the custom_edits table.  The fields originate within the code of the eWare.dll.

The captions for the fields are made up of two translation records combined into one.

e.g.

Create Follow-up Task

Is made from

  • Caption Code: Create Follow-up
  • Caption Family: GenCaptions
  • Caption Family Type: Tags
  • US Translation: Create Follow-up

and

  • Caption Code: Task
  • Caption Family: Button
  • Caption Family Type: Tags
  • US Translation: Task

Hiding the Field

If we want to either hide or remove the field then we will need to use clientside code.  This can be added to the custom content box of any of the screen (entrygroup) blocks that are used to create the New Appointment or New Task screens.

I used the customcommunicationdetail box.

I added the following code


<script>
if (window.addEventListener)
{
//firefox way of binding an event
window.addEventListener("load", hideDoFollowUpTask, false)
}
else 
if (window.attachEvent)
{
//IE exclusive method for binding an event
window.attachEvent("onload", hideDoFollowUpTask)
}
/////////////////////////////
function hideDoFollowUpTask()
{
//hide the checkbox
var arrayDoFollowUpTask = document.getElementsByName("DoFollowUpTask");
//this returns an array.
arrayDoFollowUpTask[0].style.visibility = hidden;
 
//hide the div that contains the label (the div will have an onclick event that can be examined)
var arrayDivs = document.getElementsByTagName("div");
for(i=0;i<arrayDivs.length;i++)
{
if(arrayDivs[i].onclick)
{
stronclick = new String(arrayDivs[i].onclick);
if(stronclick.search(/DoFollowUpTask/i)>-1)
{
arrayDivs[i].style.visibility = hidden;
}
}
}
}
</script>
 

Note: This code will hide the Create Follow-Up Task checkbox and caption.  It does not close up the HTML although this could be done by resetting the inner HTML of the tags that are identified in the code.  

This code can be expanded to include checks on the rights and permissions of the different users.  The CurrentUser object is created in the clientside for you to be able to reference this.

Comments
  • Hi Jeff,

    This is great and very detailed, I am having difficulty hiding both Follow-up tasks.  My script is very rusty, I would massively appreciate a hand.