Working with 'Create Follow-Up Task' and 'Create Follow-Up Appointments' using Server Side code

2 minute read time.

The image above shows the New Task screen. Both the New Task and New Appointment screens allow a user to Create Follow-up Communications.

A customer might have a business requirement to know whether the communication a user is currently entering is actually a followup of another communication. That is they need to know whether the screen has been presented to the user because they had 'ticked' a check box on the previous communication.

This might be because the default value should be entered into a field or a field might become mandatory or for some other reason.

Information available to a Create Script

A create script in the communication screen can know whether the screen is being created as a result of a 'Create Follow-up' request.

As noted in the article "How do I hide the 'Follow-up' check boxes on a New Appointment or New Task Screen Screen?" the checkboxes are fields called

  • DoFollowUpTask
  • DoFollowUpAppt

Server-side script can access the content of these fields using the FormValues() method (also known as the FormValues collection).

Create Script Example

In the CustomCommunicationDetailBox screen (Entrygroup) the following create script can be entered against the comm_action field.


Valid = false;
ErrorStr = "New Communication"
if (FormValues("DoFollowUpAppt"))
{
ErrorStr = "Follow up Appointment"
}
if (FormValues("DoFollowUpTask"))
{
ErrorStr = "Follow up Task"
}

Create Scripts and QueryStrings

Create scripts can also access the value of the QueryString so that we could also detect the different values of the variable.

To read the value of a item in the QueryString in a create script you can use the Values() method/collection e.g.


var SystemAction = Values("Act");
Valid = false;
ErrorStr = SystemAction;

The following show urls of pages called in the context of the My CRM menu.

Typical QueryString for a New Task screen

http://localhost/CRM/eware.dll/Do?SID=175223362932385 &Act=361 &Mode=1 &CLk=T &T=newactivity &Key0=4 &Key4=1

Typical QueryString for a Follow-up Task screen

http://localhost/CRM/eware.dll/Do?SID=175223362932385 &Act=361 &Mode=3 &CLk= &Key0=4 &Key4=1

Typical QueryString for a New Appointment screen

http://localhost/CRM/eware.dll/Do?SID=175223362932385 &Act=362 &Mode=1 &CLk=T &T=newactivity &Key0=4 &Key4=1

Typical QueryString for a Follow-up Appointment screen

http://localhost/CRM/eware.dll/Do?SID=175223362932385 &Act=362 &Mode=3 &CLk= &Key0=4 &Key4=1

We can see from the above examples that the system actions used are

  • New Task: 361
  • New Appointment: 362

The action called as a result of the Create Follow Up checkbox being ticked do not include the reference T=newactivity BUT this can not be used to test to prove that this is a New Communication as this variable is missing from urls called from the New Task/New Appointment buttons on the Communications tabs.