Siebel Employee Relationship Management Administration Guide > Setting Up Employee Self-Service > Designing Employee Self-Service Requestor Forms >

Effective Scripting for Employee Self-Service Requestor Forms


Using scripting is not required within Employee Self-Service, however, the functionality of the Employee Self-Service forms can be enhanced through the use of eScript or VBScript. This section provides procedures and tips for using eScript within requestor forms. You can also use VBScript.

NOTE:  You can use the eScripts within the preconfigured forms as examples. For more information on scripting, see Siebel SmartScript Administration Guide.

Related Topic

Process of Setting Up Employee Self-Service

Making a Field Read-Only

You may want to make some fields in a requestor form read-only to provide information to requestors, but prevent them from making any changes to the data in the field.

To make a field read-only in a requestor form

  1. From the application-level menu, choose Navigate > Site Map > Administration - SmartScript > Scripts.
  2. In the Scripts list, query to find the Employee Self-Service form (SmartScript) you want to modify.
  3. Click the Programs view tab.
  4. From the Programs list, select Script_Open.
  5. In the Program Language field, select eScript, and then click Save.

    In the eScript form, use the script function SetQuestionEnable(false) to set the question to read-only.

    For example, the following eScript program converts a question titled Display Employee Last Name within a page titled PAF Change. When this question displays a value extracted from a database, the value is read-only.

    function Script_Open ()

    {

    var P1 // SmartScriptPage

    var P1Q1 // SmartScriptQuestion

    P1 = GetPage("PAF Which Change");

    P1Q1 = P1.GetQuestion("Display Employee Last Name");

    P1Q1.SetQuestionEnable(false);

    }

  6. Verify that each read-only field has a SetQuestionEnable(false) statement attached to it.
  7. In the eScript form, click Check Syntax to locate any syntax problems.
  8. In the Programs list, click Save.

Preventing Duplicate Record Creation

When the form is submitted, field values mapped to a business component field are automatically written to the actual fields by SmartScript. To prevent Siebel ERM from writing to the business component field and creating duplicate records, include the Cancel() function within the script_finish program.

To prevent duplicate record creation

  1. From the application-level menu, choose Navigate > Site Map > Administration - SmartScript > Scripts.
  2. In the Scripts list, select the script, and then click the Programs view tab.
  3. In the Programs list, select Script_Finish.
  4. In the Program Language field, select eScript, and then click Save.
  5. In the eScript field, include the Cancel() function.

    For example, the following statement runs the entire SmartScript, but no updates are saved to the database, even after the user chooses Submit.

    function Script_Finish ()

    {

    // Cancel saving everything to the database

    Cancel ();

    }

  6. To make sure that data entries are always saved, whether the form is complete or incomplete, select Always in the Save Session field.

    When the form is complete, choose Finished to save data entries.

    NOTE:  Selecting Finished or Always from the Save Session field forces your Siebel application to write the values to the SmartScript session tables.

  7. Click Check Syntax to locate syntax issues, and save the record.

Populating a Field in a Form

You can use eScript to automatically populate a form.

To populate a field in a form

  1. From the application-level menu, choose Navigate > Site Map > Administration - SmartScript > Scripts.
  2. In the Scripts list, select the script you want to modify, and then click the Programs view tab.
  3. In the Programs list, select Script_Open.
  4. Use the eScript function SetCurrentValue for each field you want to populate.
  5. Click Check Syntax to locate syntax issues.
  6. Save the program.
Siebel Employee Relationship Management Administration Guide Copyright © 2009, Oracle and/or its affiliates. All rights reserved. Legal Notices.