Modifying script files

You can modify the Sage CRM Component (.ecf) and Sage CRM Script (.es) files generated by the Component Manager:

On a Sage CRM server, you can find these files in:

%ProgramFiles(x86)%\Sage\<InstallPath>\<InstallName>\inf

For example, you can specify additional parameters in the .ecf file or modify JavaScript in the .es file to do the following:

  • Make a component usable in multiple installations
  • Change screen names
  • Add messages
  • Copy ASP pages and other files from one location to another
  • Create new tables
  • Add new columns
  • Search for and replace words in ASP pages
  • Modify reports
  • Add the following views:
    • IDatabase. Returns the current Sage CRM database.
    • ILocale. Returns the installed locale. IWestern and IJapanese are two constants that can be returned.
    • sViewText. Provides a temporary storage buffer when scripting views.

Variable and constant names are case sensitive and can be used for any component APIs.

Make sure you order your code correctly when modifying the Sage CRM Script (.es) file. For more information, see Observing referential integrity.

When modifying scripts, you can pass the following parameter types to the .es script file:

  • TEXT
  • CHECKBOX
  • MULTITEXT
  • PASSWORD
  • INTEGER
  • SELECT
  • DATETIME
  • DATE

Create a parameters section in the .ecf file with the keyword Params: and put the parameters on separate lines beneath the keyword in the following format:

<Parameter Type>
<Attribute=Value>,<Attribute=Value>,<Attribute=Value>

Example

Params:
TEXT Name=ServertName,Caption=Enter server name,
Required=True CHECKBOX Name=IncludeThis,Default=On,
Caption=Include extras PASSWORD Name=Password INTEGER Name=NumUnits,
OnChange=alert('You have entered'+NumUnits.value+' units.');

When you install the component, the fields are displayed on the Parameter Info screen with the attributes you specified. To use the values entered, call the Param() method in the .es script file. For example, to retrieve the value in the Enter Server Name text box, call Param(ServerName) in the .es script file.

You can specify the following attributes for each parameter:

Attribute

Required

Description

Name

Yes

Specifies the field name.

You can use this attribute with the Param function to return the value entered by the user on the Parameter Info screen.

Default

No

Specifies the default value for the parameter.

NewLine

No

Allows you to specify the line on which to place the parameter.

This attribute can take one of the following values:

  • False. Specifies to keep the parameter on the same line as the previous one.
  • True (default). Specifies to place the parameter on a new line.

Rows

No

Specifies the number of rows that the parameter spans. The default value is 1.

Cols

No

Specifies the number of columns that the parameter spans. The default value is 1.

Required

No

Specifies if the parameter is required.

This attribute can take one of the following values:

  • True. Specifies that the user must enter a value for the parameter.
  • False. Specifies that the parameter is optional.

Validation is done when the user clicks Install Component.

ReadOnly

No

Specifies if the parameter is read-only.

This attribute can take one of the following values:

  • True. Specifies that the parameter is read-only.
  • False. Specifies that the parameter is writable.

Size

No

Specifies the maximum length of the field that contains the parameter value (in characters). The default value is 20.

This attribute is only applicable to parameters of type TEXT.

MaxLength

No

Specifies the maximum number of characters in the parameter value. The default value is 40.

Caption

No

Specifies the text label (caption) for the user interface field that shows the parameter value.

CaptionPos

No

Specifies the position of the text label (caption) relative to the field that shows the parameter value.

OnChange

No

Specifies JavaScript to run when a user changes the value in the field.

Attribute=Family

No

Specifies what caption family to use to get the drop-down list.

This attribute is only applicable to parameters of type SELECT, this specifies .