Siebel Employee Relationship Management Administration Guide > Setting Up Employee Self-Service > Creating an Employee Self-Service Requestor Form >

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.

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 View > Site Map > SmartScript Administration > 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. The scripting area appears.

  5. In the Programs list, select Script_Open.
  6. In the Program Language drop-down list, select eScript, and then click Save.
  7. In the Scripts 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);

    }

  8. Verify that each read-only field has a SetQuestionEnable(false) statement attached to it.
  9. Click the Check Syntax button to highlight any syntax problems.
  10. 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 your Siebel application 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 View > Site Map > SmartScript Administration > Scripts.
  2. In the Scripts list, query to find the script you want to modify.
  3. Click the Programs view tab.
  4. The scripting area appears.

  5. In the Programs list, select Script_Finish.
  6. In the Program Language drop-down list, select eScript, and then click Save.
  7. In the Script field, include the Cancel() function.
  8. 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 ();

    }

  9. To make sure that users' data entries are always saved, whether the form is complete or incomplete, in the Save Session field select Always.
  10. Choose Finished to save users' data entries only when the form is completed.

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

  11. Click the Check Syntax button to highlight any syntax issues.
  12. In the Programs list, click Save.

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 View > Site Map > SmartScript Administration > Scripts.
  2. In the Scripts list, query to find the script you want to modify.
  3. Click the Programs view tab.
  4. The scripting area appears.

  5. In the Programs list, select Script_Open.
  6. Use the eScript function SetCurrentValue for each field you want to populate.
  7. Click the Check Syntax button to locate any syntax issues.
  8. In the Programs list, click Save.

 Siebel Employee Relationship Management Administration Guide 
 Published: 18 April 2003