Cubic Compass Software

- Support Wiki

Dialogue Script : Server Side Programming

Modified: 2008/09/06 02:37 by mleach - Categorized as: Dialogue Script
Dialogue script supports the execution of server-side code for enforcing custom business rules and implementing workflows. Server-side Dialogue Script runs on the web server. This contrasts with Client-Side javascript, which is executed on the web browser.

Examples of using server-side Dialogue Script include:
  • Pre-populating web form values
  • Validating or modifying web form values prior to entry into a CRM system

Example Syntax
Email: <dlog:TextBox id="Email" /> <br>
First Name: <dlog:TextBox id="FirstNameTxt" /> <br>
Last Name: <dlog:TextBox id="LastNameTxt" /> <br>
<dlog:Button id="SubmitButton" Text="Register Now" /> <br>
<dlog:HiddenField id="Company" /> <br>
<dlog:HiddenField id="LeadSource" value="Web" param="src" />

<-- Start server-side execution of script -->
<% 
function UpdateCompanyName(){
   CompanyName.Value = FirstNameTxt.Text + " " + LastNameTxt.Text;
}

var isPostBack = Page.IsPostBack.ToString();

if(isPostBack == "True"){
   UpdateCompanyName();
   if(LeadSource.Text == "SpecialCampaign")
      Response.Redirect("CampaignPage.aspx");
}
%>
<-- End server-side execution of script -->

The example above has a few TextBox controls for collecting user information, a button for submitting the form, and HiddenValues for defining the user's Company name and Lead source.

'Company' is a required Lead field in Salesforce, but it's not always useful in landing page campaigns where the emphasis is often on collecting even a single piece of information (such as Email). This value can be programmatically set using Dialogue Script server-side code by concatenating the users First Name and Last Name.

The script statements between the <% and %> symbols are executed on the server. To prevent the CompanyName HiddenField from being concatenated when the page initially loads, a check for the Page.IsPostBack property is included.

A function named UpdateCompanyName is created and called only when the page is being sumitted (and prior to submission to the CRM system).

Because HiddenFields can have their values set by URL GET parameters, this form supports the ability to pass a "src=" parameter to the web form for dynamically setting LeadSource. Server-side script is checking the value of this field to determine the next page in the campaign funnel (otherwise using the default redirect URL defined in the script editor under Form Settings). Edit

Script Features

  • JavaScript based syntax: semi-colon, brackets, "var" and "function" keywords
  • JavaScript based data types: int and string are supported. Both ways of writing string constants are allowed: single-quoted and double-quoted. strings support methods: tolower, toupper, length, substr, bold and blink
  • Optional variable declaration: Variables are declared using the keyword "var". A non declared variable is considered to be a global variable
  • Mix of statements and declaration: Dialogue Script executes statements in file order. So functions should be declared before their first use
  • Object oriented: you can create objects by calling the constructor and using "new" keyword. You can set or get member values (methods and properties). The "this" keyword allows you to handle the current instance.

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam.