Siebel SmartScript Administration Guide > Extending Scripts with Siebel VB and Siebel eScript > Sample Siebel VB and Siebel eScript Methods >

Dynamic Questions

The following sample code implements dynamic insertion of an answer into a question text. Specifically, it inserts the caller's title and last name, as determined by previous questions, into the target question. The question might be entered into SmartScript as follows:

Hello. Is this [Contact.M/M] [Contact.LastName]?

Siebel VB Code

Sub Question_Enter

Dim MM as String
Dim LastName as String
Dim Q as SmartScriptQuestion
Dim Text as String

Set Q = Page.GetQuestion ("Contact: Mr/Ms")
MM = Q.GetCurrentValue

Set Q = Page.GetQuestion ("Contact: Last Name")
LastName = Q.GetCurrentValue

Text = OriginalQuestionText
Text = SubstituteText (Text, "Contact.M/M", MM)
Text = SubstituteText (Text, "Contact.Last Name", LastName)
SetQuestionText (Text)

End Sub

Siebel eScript Code

function Question_Enter ()

var MM;
var LastName;
var Q;
var Text;

Q = Page.GetQuestion ("Contact: Mr/Ms");
MM = Q.GetCurrentValue ();

Q = Page.GetQuestion ("Contact: Last Name");
LastName = Q.GetCurrentValue ();

Text = OriginalQuestionText ();
Text = SubstituteText (Text, "Contact.M/M", MM);
Text = SubstituteText (Text, "Contact.Last Name", LastName);
SetQuestionText (Text);


Siebel SmartScript Administration Guide